diff --git a/config.toml b/config.toml index f0f4a3f..e867c11 100644 --- a/config.toml +++ b/config.toml @@ -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" \ No newline at end of file diff --git a/sass/parts/_page_title.scss b/sass/parts/_page_title.scss index 88179a3..c5cfbb5 100644 --- a/sass/parts/_page_title.scss +++ b/sass/parts/_page_title.scss @@ -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; + } + } } } } diff --git a/templates/partials/history_url.html b/templates/partials/history_url.html new file mode 100644 index 0000000..9db39e9 --- /dev/null +++ b/templates/partials/history_url.html @@ -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 -%} \ No newline at end of file diff --git a/templates/post.html b/templates/post.html index 46df191..50f75f3 100644 --- a/templates/post.html +++ b/templates/post.html @@ -9,18 +9,22 @@ {% endif %}

 {{ page.authors | join(sep=', ') }} - | +  {{ page.date | date(format='%d %b %Y') }} - | + + 󱎫 {{ page.reading_time }} min +

+

{% if page.updated %} 󰚰 {{ page.updated | date(format='%d %b %Y') }} - | + + {% if config.extra.remote_repository_url %} + Changements + {% endif %} {% endif %} - 󱎫 {{ page.reading_time }} min -