Skip to content

Commit f618757

Browse files
Adds support for repositories (alshedivat#760)
* Add support for github repo cards * add support for dark theme * Add support for custom theme * repositories * fix * make it simpler * spcaing * responsive fix * adds support for usernames * make it modular * fix * show icons * cache_seconds * fix * Revert "cache_seconds" This reverts commit a9dd4d5. * add last line * fix * github only * fix * Add instructions * Add `README.md` instructions * Add `nav_order`
1 parent 99b14c4 commit f618757

File tree

11 files changed

+125
-5
lines changed

11 files changed

+125
-5
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,32 @@ Easily create beautiful grids within your blog posts and project pages:
439439

440440
### Other features
441441

442+
#### GitHub repositories and user stats
443+
**al-folio** uses [github-readme-stats](https://github.com/anuraghazra/github-readme-stats) to display GitHub repositories and user stats on the the `/repositories/` page.
444+
445+
Edit the `_data/repositories.yml` and change the `github_users` and `github_repos` lists to include your own GitHub profile and repositories to the the `/repositories/` page.
446+
447+
You may also use the following codes for displaying this in any other pages.
448+
```
449+
<!-- code for GitHub users -->
450+
{% if site.data.repositories.github_users %}
451+
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
452+
{% for user in site.data.repositories.github_users %}
453+
{% include repository/repo_user.html username=user %}
454+
{% endfor %}
455+
</div>
456+
{% endif %}
457+
458+
<!-- code for GitHub repositories -->
459+
{% if site.data.repositories.github_repos %}
460+
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
461+
{% for repo in site.data.repositories.github_repos %}
462+
{% include repository/repo.html repository=repo %}
463+
{% endfor %}
464+
</div>
465+
{% endif %}
466+
```
467+
442468
#### Theming
443469
Six beautiful theme colors have been selected to choose from.
444470
The default is purple, but you can quickly change it by editing `$theme-color` variable in the `_sass/_themes.scss` file.

_config.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ baseurl: /al-folio # the subpath of your site, e.g. /blog/
2323
last_updated: false # set to true if you want to display last updated in the footer
2424
impressum_path: # set to path to include impressum link in the footer, use the same path as permalink in a page, helps to conform with EU GDPR
2525

26+
# -----------------------------------------------------------------------------
27+
# Theme
28+
# -----------------------------------------------------------------------------
29+
30+
# code highlighter theme
31+
highlight_theme_light: github # https://github.com/jwarby/jekyll-pygments-themes
32+
highlight_theme_dark: native # https://github.com/jwarby/jekyll-pygments-themes
33+
34+
# repo color theme
35+
repo_theme_light: default # https://github.com/anuraghazra/github-readme-stats/blob/master/themes/README.md
36+
repo_theme_dark: dark # https://github.com/anuraghazra/github-readme-stats/blob/master/themes/README.md
37+
2638
# -----------------------------------------------------------------------------
2739
# RSS Feed
2840
# -----------------------------------------------------------------------------
@@ -133,8 +145,6 @@ news_limit: 5 # leave blank to include all the news in the `_news` folder
133145
# Markdown and syntax highlight
134146
markdown: kramdown
135147
highlighter: rouge
136-
highlight_theme_light: github # https://github.com/jwarby/jekyll-pygments-themes
137-
highlight_theme_dark: native # https://github.com/jwarby/jekyll-pygments-themes
138148
kramdown:
139149
input: GFM
140150
syntax_highlighter_opts:

_data/repositories.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
github_users:
2+
- torvalds
3+
- alshedivat
4+
5+
github_repos:
6+
- alshedivat/al-folio
7+
- twbs/bootstrap
8+
- jekyll/jekyll
9+
- jquery/jquery
10+
- FortAwesome/Font-Awesome
11+
- jpswalsh/academicons
12+
- mathjax/MathJax

_includes/repository/repo.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{% assign repo_url = include.repository | split: '/' %}
2+
3+
{% if site.data.repositories.github_users contains repo_url.first %}
4+
{% assign show_owner = false %}
5+
{% else %}
6+
{% assign show_owner = true %}
7+
{% endif %}
8+
9+
<div class="repo p-2 text-center">
10+
<a href="https://github.com/{{ include.repository }}">
11+
<img class="repo-img-light w-100" alt="{{ include.repository }}" src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url.first }}&repo={{ repo_url.last }}&theme={{ site.repo_theme_light }}&show_owner={{ show_owner }}">
12+
<img class="repo-img-dark w-100" alt="{{ include.repository }}" src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url.first }}&repo={{ repo_url.last }}&theme={{ site.repo_theme_dark }}&show_owner={{ show_owner }}">
13+
</a>
14+
</div>

_includes/repository/repo_user.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<div class="repo p-2 text-center">
2+
<a href="https://github.com/{{ include.username }}">
3+
<img class="repo-img-light w-100" alt="{{ include.username }}" src="https://github-readme-stats.vercel.app/api/?username={{ include.username }}&theme={{ site.repo_theme_light }}&show_icons=true">
4+
<img class="repo-img-dark w-100" alt="{{ include.username }}" src="https://github-readme-stats.vercel.app/api/?username={{ include.username }}&theme={{ site.repo_theme_dark }}&show_icons=true">
5+
</a>
6+
</div>

_pages/cv.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ layout: cv
33
permalink: /cv/
44
title: cv
55
nav: true
6-
nav_order: 3
6+
nav_order: 4
77
cv_pdf: example_pdf.pdf
88
---

_pages/dropdown.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: page
33
title: submenus
44
nav: true
5-
nav_order: 5
5+
nav_order: 6
66
dropdown: true
77
children:
88
- title: publications

_pages/repositories.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
layout: page
3+
permalink: /repositories/
4+
title: repositories
5+
description: Edit the `_data/repositories.yml` and change the `github_users` and `github_repos` lists to include your own GitHub profile and repositories.
6+
nav: true
7+
nav_order: 3
8+
---
9+
10+
## GitHub users
11+
12+
{% if site.data.repositories.github_users %}
13+
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
14+
{% for user in site.data.repositories.github_users %}
15+
{% include repository/repo_user.html username=user %}
16+
{% endfor %}
17+
</div>
18+
{% endif %}
19+
20+
---
21+
22+
## GitHub Repositories
23+
24+
{% if site.data.repositories.github_repos %}
25+
<div class="repositories d-flex flex-wrap flex-md-row flex-column justify-content-between align-items-center">
26+
{% for repo in site.data.repositories.github_repos %}
27+
{% include repository/repo.html repository=repo %}
28+
{% endfor %}
29+
</div>
30+
{% endif %}

_pages/teaching.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permalink: /teaching/
44
title: teaching
55
description: Materials for courses you taught. Replace this text with your description.
66
nav: true
7-
nav_order: 4
7+
nav_order: 5
88
---
99

1010
For now, this page is assumed to be a static description of your courses. You can convert it to a collection similar to `_projects/` so that you can have a dedicated page for each course.

_sass/_base.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,14 @@ footer.sticky-bottom {
312312
}
313313
}
314314

315+
// Repositories
316+
317+
@media (min-width: 768px) {
318+
.repo {
319+
max-width: 50%;
320+
}
321+
}
322+
315323
// Blog
316324

317325
.header-bar {

0 commit comments

Comments
 (0)