feat: rewrite metadata + add changelog link on article

This commit is contained in:
Alexis Fourmaux 2025-05-16 20:08:18 +02:00
parent 32c6db3377
commit 4a5ee3cd67
4 changed files with 66 additions and 12 deletions

View file

@ -19,3 +19,8 @@ render_emoji = true
[slugify] [slugify]
paths = "safe" paths = "safe"
anchor = "safe" anchor = "safe"
[extra]
remote_repository_url = "https://forge.kworld.fr/Ungol/blog"
remote_repository_branch = "main"
remote_repository_git_platform = "gitlab"

View file

@ -1,6 +1,6 @@
section { section {
&.title { &.title {
margin-bottom: 2.5rem; margin-bottom: 4rem;
&>h1.title { &>h1.title {
font-size: 3rem; font-size: 3rem;
@ -14,17 +14,36 @@ section {
color: var(--subtext1); color: var(--subtext1);
font-size: 1.5rem; font-size: 1.5rem;
margin-top: 0; margin-top: 0;
margin-bottom: 2.5rem; margin-bottom: .5rem;
} }
&.last-update,
&.metadata { &.metadata {
color: var(--subtext1); color: var(--overlay1);
font-size: .8rem; font-size: .8rem;
text-align: center; text-align: start;
margin: 0; margin: 0;
border-bottom-width: 1px;
border-bottom-color: var(--overlay0); .separator {
border-bottom-style: solid; margin-left: .1rem;
margin-right: .1rem;
}
a {
text-decoration: none;
color: var(--overlay1);
&:hover {
color: var(--teal);
}
&.external-link::after {
content: "";
font-size: .5rem;
font-variant-position: super;
margin-left: .1rem;
}
}
} }
} }
} }

View file

@ -0,0 +1,26 @@
{%- set relative_path = page.relative_path -%}
{%- set repository_url = config.extra.remote_repository_url | trim_end_matches(pat='/') -%}
{%- set branch = config.extra.remote_repository_branch | default(value="main") -%}
{%- set git_platform = config.extra.remote_repository_git_platform | default(value="auto") -%}
{# Auto-detect the git platform based on the URL#}
{%- if git_platform == "auto" %}
{%- if repository_url is containing("github.") -%}
{%- set git_platform = "github" -%}
{%- elif repository_url is containing("gitlab.") -%}
{%- set git_platform = "gitlab" -%}
{%- elif repository_url is matching("(gitea\.|codeberg\.)") -%}
{%- set git_platform = "gitea" -%}
{%- endif -%}
{%- endif -%}
{# Generate the commit history URL based on the git platform #}
{%- if git_platform == "github" -%}
{{ repository_url ~ '/commits/' ~ branch ~ '/content/' }}{{ relative_path | urlencode }}
{%- elif git_platform == "gitlab" -%}
{{ repository_url ~ '/-/commits/' ~ branch ~ '/content/' }}{{ relative_path | urlencode }}
{%- elif git_platform in ["gitea", "codeberg"] -%}
{{ repository_url ~ '/commits/branch/' ~ branch ~ '/content/' }}{{ relative_path | urlencode }}
{%- else -%}
{{ throw(message="ERROR: Unknown, unsupported, or unspecified git platform. If you're using a custom domain, please specify the 'git_platform' in the config.") }}
{%- endif -%}

View file

@ -9,18 +9,22 @@
{% endif %} {% endif %}
<p class=metadata> <p class=metadata>
<span> {{ page.authors | join(sep=', ') }}</span> <span> {{ page.authors | join(sep=', ') }}</span>
| <span class="separator"></span>
<span> <span>
<meta itemprop="datePublished" content="{{ page.date | date(format='%+') }}"> <meta itemprop="datePublished" content="{{ page.date | date(format='%+') }}">
 {{ page.date | date(format='%d %b %Y') }}  {{ page.date | date(format='%d %b %Y') }}
</span> </span>
| <span class="separator"></span>
<span>󱎫 {{ page.reading_time }} min</span>
</p>
<p class="last-update">
{% if page.updated %} {% if page.updated %}
<span>󰚰 {{ page.updated | date(format='%d %b %Y') }}</span> <span>󰚰 {{ page.updated | date(format='%d %b %Y') }}</span>
| <span class="separator"></span>
{% if config.extra.remote_repository_url %}
<a class="external-link" href="{% include 'partials/history_url.html'%}" target="_blank" rel="noopener noreferrer">Changements</a>
{% endif %}
{% endif %} {% endif %}
<span>󱎫 {{ page.reading_time }} min</span>
</p> </p>
</section> </section>
<section> <section>