From b3e293ece91e0ba4d3f81fc93aaca551d2358051 Mon Sep 17 00:00:00 2001 From: squidfunk <martin.donath@squidfunk.com> Date: Sun, 11 Feb 2018 19:55:36 +0100 Subject: [PATCH] Fixed duplicate slashes in source file URLs --- material/base.html | 6 +++++- src/base.html | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/material/base.html b/material/base.html index 428f38be..3c947341 100644 --- a/material/base.html +++ b/material/base.html @@ -145,9 +145,13 @@ {% block source %} {% if page and page.meta and page.meta.source %} <h2 id="__source">{{ lang.t("meta.source") }}</h2> + {% set repo = config.repo_url %} + {% if repo | last == "/" %} + {% set repo = repo[:-1] %} + {% endif %} {% set path = page.meta.path | default([""]) %} {% set file = page.meta.source %} - <a href="{{ [config.repo_url, path, file] | join('/') }}" title="{{ file }}" class="md-source-file"> + <a href="{{ [repo, path, file] | join('/') }}" title="{{ file }}" class="md-source-file"> {{ file }} </a> {% endif %} diff --git a/src/base.html b/src/base.html index edefba32..98da99cf 100644 --- a/src/base.html +++ b/src/base.html @@ -276,9 +276,13 @@ {% block source %} {% if page and page.meta and page.meta.source %} <h2 id="__source">{{ lang.t("meta.source") }}</h2> + {% set repo = config.repo_url %} + {% if repo | last == "/" %} + {% set repo = repo[:-1] %} + {% endif %} {% set path = page.meta.path | default([""]) %} {% set file = page.meta.source %} - <a href="{{ [config.repo_url, path, file] | join('/') }}" + <a href="{{ [repo, path, file] | join('/') }}" title="{{ file }}" class="md-source-file"> {{ file }} </a> -- GitLab