Skip to content

Commit 52487e5

Browse files
authored
feat: add Github stars and last commit (#587)
* feat: add Github stars and last commit * fix: fix alt name * ci: create artifact for generated site
1 parent adf5d4c commit 52487e5

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ jobs:
2121
run: curl -L ${BASE_URL}/${VERS}/zola-${VERS}-${ARCH}.tar.gz | tar -xz
2222
- run: ./zola --version
2323
- run: ./zola build
24+
- uses: actions/upload-artifact@v4
25+
with:
26+
path: public
27+
retention-days: 10
2428
- name: Deploy
2529
if: github.ref == 'refs/heads/master'
2630
uses: crazy-max/ghaction-github-pages@v3

templates/categories/macros.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
{% set data = load_data(url="https://api.github.com/repos/" ~ item.name, format="json") %}
2121
{% set name = data.name %}
2222
{% set repository_url = data.html_url %}
23+
{# Org or User name #}
24+
{% set owner = data.owner.login %}
2325
{% if data.homepage != "" %}
2426
{% set homepage_url = data.homepage %}
2527
{% endif %}
@@ -103,9 +105,8 @@
103105
</div>
104106
</div>
105107

106-
{% if item.source and item.source == 'crates' or gitter_url %}
108+
{% if item.source or gitter_url %}
107109
<div class="extra content">
108-
{# only projects hosted on crates get badges for now #}
109110

110111
<div class="ui horizontal list">
111112
{% if item.source and item.source == 'crates' %}
@@ -138,6 +139,22 @@
138139
</div>
139140
</div>
140141
{% endif %}
142+
{% if item.source and item.source == 'github' %}
143+
<div class="item" aria-hidden="true">
144+
<div class="content">
145+
<a href="https://github.com/{{owner}}/{{name}}">
146+
<img src="https://img.shields.io/github/stars/{{owner}}/{{name}}" alt="Github Stars for {{ name }}">
147+
</a>
148+
</div>
149+
</div>
150+
<div class="item" aria-hidden="true">
151+
<div class="content">
152+
<a href="https://github.com/{{owner}}/{{name}}">
153+
<img src="https://img.shields.io/github/last-commit/{{owner}}/{{name}}" alt="Last commit date for {{ name }}">
154+
</a>
155+
</div>
156+
</div>
157+
{% endif %}
141158
{% if gitter_url %}
142159
<div class="item">
143160
<div class="content">

0 commit comments

Comments
 (0)