Skip to content

Commit 5832583

Browse files
committed
fix: Allow customization of revision link in footer
Introduce two new site variables for improved flexibility in rendering the revision link: - `github_repository`: Specifies the GitHub repository hosting the site sources (always set). - `github_short_sha`: Optionally set to a predefined value; if not initialized, it defaults to the value retrieved using the `project_version` Jekyll plugin. This ensures that the revision link in the footer correctly references the intended repository and commit, even when `github_short_sha` is externally provided.
1 parent 8312a03 commit 5832583

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Diff for: _config.yml

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ slicer_download_url: "https://download.slicer.org"
3030
slicer_download_stats_url: "https://download.slicer.org/download-stats"
3131
slicer_training_url: "https://www.slicer.org/wiki/Documentation/Nightly/Training"
3232

33+
# Specify the name of the GitHub repository hosting the sources of the generated site.
34+
github_repository: Slicer/slicer.org
35+
3336
# Specifies whether the configuration is for the primary site (https://slicer.org).
3437
# Set to "true" for slicer.org and "false" for auxiliary sites.
3538
#

Diff for: _includes/footer.html

+8-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44
<div class="content is-small has-text-centered">
55
Content of this site is Copyright {{ site.time | date: "%Y" }} BWH and 3D Slicer contributors, unless otherwise noted.
66
<br>For questions about the use of this site's content, please see <a href="https://www.slicer.org/wiki/Contact">Contact</a>.
7-
<br>Last update {{ site.time | date: "%Y-%m-%d" }}. Revision <a id="revision" href="https://github.com/Slicer/slicer.org/commit/{% project_version commit short %}">{% project_version commit short %}</a>.
7+
{%- if site.github_short_sha and site.github_short_sha != "" and site.github_short_sha != nil -%}
8+
{%- assign github_short_sha = site.github_short_sha -%}
9+
{%- else -%}
10+
{%- capture github_short_sha -%}
11+
{%- project_version commit short -%}
12+
{%- endcapture -%}
13+
{%- endif -%}
14+
<br>Last update {{ site.time | date: "%Y-%m-%d" }}. Revision <a id="revision" href="https://github.com/{{ site.github_repository }}/commit/{{ github_short_sha }}">{{ github_short_sha }}</a>.
815
</div>
916
</div>
1017
</footer>

0 commit comments

Comments
 (0)