feat: rewrite metadata + add changelog link on article
This commit is contained in:
parent
8556f360dd
commit
c332052930
4 changed files with 66 additions and 12 deletions
|
|
@ -19,3 +19,8 @@ render_emoji = true
|
|||
[slugify]
|
||||
paths = "safe"
|
||||
anchor = "safe"
|
||||
|
||||
[extra]
|
||||
remote_repository_url = "https://forge.kworld.fr/Ungol/blog"
|
||||
remote_repository_branch = "main"
|
||||
remote_repository_git_platform = "gitlab"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
section {
|
||||
&.title {
|
||||
margin-bottom: 2.5rem;
|
||||
margin-bottom: 4rem;
|
||||
|
||||
&>h1.title {
|
||||
font-size: 3rem;
|
||||
|
|
@ -14,17 +14,36 @@ section {
|
|||
color: var(--subtext1);
|
||||
font-size: 1.5rem;
|
||||
margin-top: 0;
|
||||
margin-bottom: 2.5rem;
|
||||
margin-bottom: .5rem;
|
||||
}
|
||||
|
||||
&.last-update,
|
||||
&.metadata {
|
||||
color: var(--subtext1);
|
||||
color: var(--overlay1);
|
||||
font-size: .8rem;
|
||||
text-align: center;
|
||||
text-align: start;
|
||||
margin: 0;
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-color: var(--overlay0);
|
||||
border-bottom-style: solid;
|
||||
|
||||
.separator {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
templates/partials/history_url.html
Normal file
26
templates/partials/history_url.html
Normal 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 -%}
|
||||
|
|
@ -9,18 +9,22 @@
|
|||
{% endif %}
|
||||
<p class=metadata>
|
||||
<span> {{ page.authors | join(sep=', ') }}</span>
|
||||
|
|
||||
<span class="separator">•</span>
|
||||
<span>
|
||||
<meta itemprop="datePublished" content="{{ page.date | date(format='%+') }}">
|
||||
{{ page.date | date(format='%d %b %Y') }}
|
||||
</span>
|
||||
|
|
||||
<span class="separator">•</span>
|
||||
<span> {{ page.reading_time }} min</span>
|
||||
</p>
|
||||
<p class="last-update">
|
||||
{% if page.updated %}
|
||||
<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 %}
|
||||
<span> {{ page.reading_time }} min</span>
|
||||
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue