Skip to content

Commit f4a6e18

Browse files
authored
Fix repo card heigth for different repo descriptions (#2525)
Hello! I had this minor issue on my website and I saw few other people using this template and having the same issue. **Brief** if two repo's in the same row has different number of lines for the descriptions, heights of the cards will not be the same if we don't force the number of lines to be displayed. **Solution** By looking at [This issue](anuraghazra/github-readme-stats#2900) I could see that they solved it by adding an new option, `description_lines_count`. This was used on the API request in order to fix the issue. --- ## Issue reproduced: ![before](https://github.com/alshedivat/al-folio/assets/15076325/238931f5-8a0e-45c5-a9bb-e9c6e4c0f04b) --- ## Issue fixed after the commit: ![after](https://github.com/alshedivat/al-folio/assets/15076325/a0e79cdf-fd6a-4765-b21f-279540ae88fe)
1 parent fefa247 commit f4a6e18

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

_data/repositories.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ github_users:
22
- torvalds
33
- alshedivat
44

5+
repo_description_lines_max: 2
6+
57
github_repos:
68
- alshedivat/al-folio
7-
- twbs/bootstrap
89
- jekyll/jekyll
10+
- twbs/bootstrap
911
- jquery/jquery
1012
- FortAwesome/Font-Awesome
11-
- jpswalsh/academicons
1213
- mathjax/MathJax
14+
- jpswalsh/academicons

_includes/repository/repo.liquid

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,23 @@
55
{% assign show_owner = true %}
66
{% endif %}
77

8+
{% if site.data.repositories.repo_description_lines_max %}
9+
{% assign max_lines = site.data.repositories.repo_description_lines_max %}
10+
{% else %}
11+
{% assign max_lines = 2 %}
12+
{% endif %}
13+
814
<div class="repo p-2 text-center">
915
<a href="https://github.com/{{ include.repository }}">
1016
<img
1117
class="repo-img-light w-100"
1218
alt="{{ include.repository }}"
13-
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_light }}&show_owner={{ show_owner }}"
19+
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_light }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
1420
>
1521
<img
1622
class="repo-img-dark w-100"
1723
alt="{{ include.repository }}"
18-
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_dark }}&show_owner={{ show_owner }}"
24+
src="https://github-readme-stats.vercel.app/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_dark }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
1925
>
2026
</a>
2127
</div>

0 commit comments

Comments
 (0)