From f997e5d16e56bd68acc75982aa93d35b38057712 Mon Sep 17 00:00:00 2001 From: Ungol Date: Tue, 23 Dec 2025 22:27:52 +0100 Subject: [PATCH] fix: use my own forge to link to articles changes --- config.toml | 4 ++-- templates/partials/history_url.html | 15 ++------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/config.toml b/config.toml index e867c11..fe8147c 100644 --- a/config.toml +++ b/config.toml @@ -21,6 +21,6 @@ paths = "safe" anchor = "safe" [extra] -remote_repository_url = "https://forge.kworld.fr/Ungol/blog" +remote_repository_url = "https://forge.ungol.fr/Ungol/blog" remote_repository_branch = "main" -remote_repository_git_platform = "gitlab" \ No newline at end of file +remote_repository_git_platform = "forgejo" \ No newline at end of file diff --git a/templates/partials/history_url.html b/templates/partials/history_url.html index 9db39e9..7691be4 100644 --- a/templates/partials/history_url.html +++ b/templates/partials/history_url.html @@ -1,25 +1,14 @@ {%- 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 -%} +{%- set git_platform = config.extra.remote_repository_git_platform -%} {# 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"] -%} +{%- elif git_platform in ["gitea", "codeberg", "forgejo"] -%} {{ 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.") }}