pages/_layouts/post.liquid
Jaskirat Singh Maskeen d86331af3c
Fix #2598, shift to last_modified_at instead of last_updated. (#3493)
Use `last_modified_at` rather than `last_updated`. So that the
jekyll-sitemap plugin automatically looks for the standard
`last_modified_at` front matter field to generate the `<lastmod>` tag in
your `sitemap.xml`.

It fixes [#2598](https://github.com/alshedivat/al-folio/issues/2598) 

Also, it preserves backward compatibility, as the updated metadata logic
prioritizes the `page.last_modified_at`, and defaults to
`page.last_updated`.
2026-01-31 12:38:24 -03:00

98 lines
3.0 KiB
Plaintext

---
layout: default
---
{% assign year = page.date | date: '%Y' %}
{% assign tags = page.tags | join: '' %}
{% assign categories = page.categories | join: '' %}
{% assign url_beginning = page.url | slice: 0, 6 %}
{% if page._styles %}
<!-- Page/Post style -->
<style type="text/css">
{{ page._styles }}
</style>
{% endif %}
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
<p class="post-meta">
Created on {{ page.date | date: '%B %d, %Y' }}
{% if page.author %}by {{ page.author }}{% endif %}
{% assign last_date = page.last_modified_at | default: page.last_updated %}
{% if last_date %}, last updated on {{ last_date | date: '%B %d, %Y' }}{% endif %}
{% if page.meta %}• {{ page.meta }}{% endif %}
</p>
<p class="post-tags">
{% if url_beginning == '/blog/' %}
<a href="{{ year | prepend: '/blog/' | relative_url }}"> <i class="fa-solid fa-calendar fa-sm"></i> {{ year }} </a>
{% else %}
<i class="fa-solid fa-calendar fa-sm"></i> {{ year }}
{% endif %}
{% if tags != '' %}
&nbsp; &middot; &nbsp;
{% for tag in page.tags %}
{% if url_beginning == '/blog/' %}
<a href="{{ tag | slugify | prepend: '/blog/tag/' | relative_url }}"> <i class="fa-solid fa-hashtag fa-sm"></i> {{ tag }}</a>
{% else %}
<i class="fa-solid fa-hashtag fa-sm"></i> {{ tag }}
{% endif %}
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}
{% if categories != '' %}
&nbsp; &middot; &nbsp;
{% for category in page.categories %}
{% if url_beginning == '/blog/' %}
<a href="{{ category | slugify | prepend: '/blog/category/' | relative_url }}"> <i class="fa-solid fa-tag fa-sm"></i> {{ category -}}</a>
{% else %}
<i class="fa-solid fa-tag fa-sm"></i> {{ category }}
{% endif %}
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}
</p>
</header>
<article class="post-content">
{% if page.toc and page.toc.beginning %}
<div id="table-of-contents">
{% toc %}
</div>
<hr>
{% endif %}
<div id="markdown-content">
{{ content }}
</div>
</article>
{% if page.citation %}
{% include citation.liquid %}
{% endif %}
{% if page.related_publications %}
<h2>References</h2>
<div class="publications">
{% bibliography --group_by none --cited_in_order %}
</div>
{% endif %}
{% if site.related_blog_posts and site.related_blog_posts.enabled %}
{% if page.related_posts == null or page.related_posts %}
{% include related_posts.liquid %}
{% endif %}
{% endif %}
{% if site.disqus_shortname and page.disqus_comments %}
{% include disqus.liquid %}
{% endif %}
{% if site.giscus and page.giscus_comments %}
{% include giscus.liquid %}
{% endif %}
</div>