Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ruby
# https://github.com/ruby/setup-ruby/releases/tag/v1.207.0
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
Expand Down
48 changes: 48 additions & 0 deletions _includes/components/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% capture footer_custom %}
{%- include footer_custom.html -%}
{% endcapture %}
<hr>
<footer>
{% if site.back_to_top %}
<p><a href="#top" id="back-to-top">{{ site.back_to_top_text }}</a></p>
{% endif %}

{{ footer_custom }}

{% if site.last_edit_timestamp or site.gh_edit_link %}
<div class="d-flex mt-2">
{% if site.last_edit_timestamp and site.last_edit_time_format and page.last_modified_date %}
<p class="text-small mb-0 mr-2">
{% if page.author %}Created by <strong>{{ page.author }}</strong>{% if page.created_at %} on {{ page.created_at | date: site.last_edit_time_format }}{% endif %}. {% endif %}
Page last modified: <span class="d-inline-block">{{ page.last_modified_date | date: site.last_edit_time_format }}</span>.
</p>
{% endif %}
{% if
site.gh_edit_link and
site.gh_edit_link_text and
site.gh_edit_repository and
site.gh_edit_branch and
site.gh_edit_view_mode
%}
<p class="text-small mb-0">
<a href="{{ site.gh_edit_repository }}/{{ site.gh_edit_view_mode }}/{{ site.gh_edit_branch }}{% if site.gh_edit_source %}/{{ site.gh_edit_source }}{% endif %}{% if page.collection and site.collections_dir %}/{{ site.collections_dir }}{% endif %}/{{ page.path }}" id="edit-this-page">{{ site.gh_edit_link_text }}</a>
</p>
{% endif %}
</div>
{% endif %}

{%- comment -%}
note: nav_footer_custom and/or this "site footer" appear in components/sidebar.html for the desktop view.
{%- endcomment -%}

<div class="d-md-none mt-4 fs-2">
{% capture nav_footer_custom %}
{%- include nav_footer_custom.html -%}
{% endcapture %}
{% if nav_footer_custom != "" %}
{{ nav_footer_custom }}
{% else %}
This site uses <a href="https://github.com/just-the-docs/just-the-docs">Just the Docs</a>, a documentation theme for Jekyll.
{% endif %}
</div>
</footer>
24 changes: 24 additions & 0 deletions _plugins/git_metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Jekyll::Hooks.register [:pages, :documents], :post_init do |doc|
path = doc.path

if path && File.exist?(path)
# Fetch git history for this specific file
# %ad: author date, %an: author name
git_log = `git log --follow --format="%ad|%an" --date=iso-strict -- "#{path}" 2>/dev/null`.strip

unless git_log.empty?
logs = git_log.split("\n")

# First commit (oldest) = creation date
first_commit = logs.last.split('|')
doc.data["created_at"] ||= first_commit.first

# Last commit (newest) = last modified date
last_commit = logs.first.split('|')
doc.data["last_modified_date"] ||= last_commit.first

# Current author (last modifying author)
doc.data["author"] ||= last_commit.last
end
end
end