diff --git a/material/base.html b/material/base.html
index 428f38be63af9ececad67c0445f61091b2469dd5..3c9473419d1fe610a3c4bde9672f6ab1d56fd32f 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 edefba32518966a6582c46e7930f3c9cc861cf0f..98da99cf6f7d357421dcf1eb35c431ed1565edab 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>