15 lines
No EOL
975 B
HTML
15 lines
No EOL
975 B
HTML
{%- 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 -%}
|
|
|
|
{# 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", "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.") }}
|
|
{%- endif -%} |