## Description This PR makes the URLs for external services used on the repository page configurable in `_config.yml`. This allows users to self-host these services for better reliability, privacy, and customization. ## Changes - Added `external_services` configuration section in `_config.yml` with: - `github_readme_stats_url` (default: `https://github-readme-stats.vercel.app`) - `github_profile_trophy_url` (default: `https://github-profile-trophy.vercel.app`) - Updated repository template files to use configurable URLs: - `_includes/repository/repo_user.liquid` - `_includes/repository/repo.liquid` - `_includes/repository/repo_trophies.liquid` - Added documentation in `CUSTOMIZE.md` explaining: - Why self-hosting is recommended (default services may have availability issues) - How to configure custom service URLs - Links to the service repositories for deployment instructions ## Resolves Resolves #3388 - This makes it possible to configure self-hosted versions of these services, giving users full control over the external services used for displaying GitHub statistics and trophies. ## Testing - Verified that default configuration still works with original service URLs - Confirmed that URLs are properly interpolated in all template files - Documentation clearly explains the configuration options
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
{% assign repo_url = include.repository | split: '/' %}
|
|
{% if site.data.repositories.github_users contains repo_url.first %}
|
|
{% assign show_owner = false %}
|
|
{% else %}
|
|
{% assign show_owner = true %}
|
|
{% endif %}
|
|
|
|
{% assign lang = site.lang | split: '-' | first %}
|
|
|
|
{% case lang %}
|
|
{% when 'pt' %}
|
|
{% assign lang = site.lang %}
|
|
|
|
{% when 'zh' %}
|
|
{% assign lang_last = site.lang | split: '-' | last %}
|
|
{% case lang_last %}
|
|
{% when 'cn', 'sg', 'my', 'hans' %}
|
|
{% assign lang = 'cn' %}
|
|
{% when 'tw', 'hk', 'mo', 'hant' %}
|
|
{% assign lang = 'zh-tw' %}
|
|
{% endcase %}
|
|
|
|
{% comment %} Add a new language using when... if needed {% endcomment %}
|
|
{% comment %} If you still encounter language-display issues, check the available locale codes in github-readme-stats (different from ISO-639 standard used in your website) {% endcomment %}
|
|
{% comment %} https://github.com/anuraghazra/github-readme-stats?tab=readme-ov-file#available-locales {% endcomment %}
|
|
{% endcase %}
|
|
|
|
{% if site.data.repositories.repo_description_lines_max %}
|
|
{% assign max_lines = site.data.repositories.repo_description_lines_max %}
|
|
{% else %}
|
|
{% assign max_lines = 2 %}
|
|
{% endif %}
|
|
|
|
<div class="repo p-2 text-center">
|
|
<a href="https://github.com/{{ include.repository }}">
|
|
<img
|
|
class="only-light w-100"
|
|
alt="{{ include.repository }}"
|
|
src="{{ site.external_services.github_readme_stats_url }}/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_light }}&locale={{ lang }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
|
|
>
|
|
<img
|
|
class="only-dark w-100"
|
|
alt="{{ include.repository }}"
|
|
src="{{ site.external_services.github_readme_stats_url }}/api/pin/?username={{ repo_url[0] }}&repo={{ repo_url[1] }}&theme={{ site.repo_theme_dark }}&locale={{ lang }}&show_owner={{ show_owner }}&description_lines_count={{ max_lines }}"
|
|
>
|
|
</a>
|
|
</div>
|