diff --git a/_includes/all_keypoints.html b/_includes/all_keypoints.html
index 8563df340a8df11ffb4a23e27c15f31be15ed56b..2af59005fae82283f72968406e61dea5e9c87b9b 100644
--- a/_includes/all_keypoints.html
+++ b/_includes/all_keypoints.html
@@ -7,7 +7,7 @@
{% unless episode.break %}
|
- {{ episode.title }}
+ {{ episode.title }}
|
diff --git a/_includes/base_path.html b/_includes/base_path.html
new file mode 100644
index 0000000000000000000000000000000000000000..0acf4b94888969a528843b73ddaef1454b054b46
--- /dev/null
+++ b/_includes/base_path.html
@@ -0,0 +1,27 @@
+{% comment %}
+This is adapated from: https://ricostacruz.com/til/relative-paths-in-jekyll
+
+`page.url` gives the URL of the current page with a leading /:
+
+- when the URL ends with the extension (e.g., /foo/bar.html) then we can get
+ the depth by counting the number of / and remove - 1
+- when the URL ends with a / (e.g. /foo/bar/) then the number / gives the depth
+ directly
+{% endcomment %}
+
+{% assign relative_root_path = '' %}
+
+{% assign last_char = page.url | slice: -1 %}
+
+{% if last_char == "/"}
+{% assign offset = 0 %}
+{% else %}
+{% assign offset = 1 %}
+{% endif %}
+
+{% assign depth = page.url | split: '/' | size | minus: offset %}
+{% if depth <= 1 %}{% assign relative_root_path = '.' %}
+{% elsif depth == 2 %}{% assign relative_root_path = '..' %}
+{% elsif depth == 3 %}{% assign relative_root_path = '../..' %}
+{% elsif depth == 4 %}{% assign relative_root_path = '../../..' %}
+{% endif %}
diff --git a/_includes/carpentries.html b/_includes/carpentries.html
index 0a6953df9860e0025ce8bf0e093d2cfe8c87643c..37cd16e04d394ad90c2d70554b191f90ad632668 100644
--- a/_includes/carpentries.html
+++ b/_includes/carpentries.html
@@ -3,7 +3,7 @@
{% endcomment %}
- 
+
- 
+
Since 1998, Software Carpentry has
@@ -38,7 +38,7 @@
- 
+
Data Carpentry develops and teaches
@@ -53,7 +53,7 @@
- 
+
Library Carpentry is in discussions with
diff --git a/_includes/episode_navbar.html b/_includes/episode_navbar.html
index c2bc80e84105e5d6c2bef7c830e23ea01f264c02..74f63e0f80caa2d4b50f2d7fa420df7954a81610 100644
--- a/_includes/episode_navbar.html
+++ b/_includes/episode_navbar.html
@@ -5,23 +5,23 @@
{% if include.episode_navbar_title %}
-
+
{% endif %}
diff --git a/_includes/favicons.html b/_includes/favicons.html
index 4ea6742d530460e08517cfabbd912c69f937b1d4..8a50b4d911591886ed90c11bb23a5cee5cfd7d6b 100644
--- a/_includes/favicons.html
+++ b/_includes/favicons.html
@@ -1,4 +1,4 @@
-{% assign favicon_url = site.baseurl | append: '/assets/favicons/' | append: site.carpentry | prepend: site.url %}
+{% assign favicon_url = relative_root_path | append: '/assets/favicons/' | append: site.carpentry %}
{% if site.carpentry == 'swc' %}
{% assign carpentry = 'Software Carpentry' %}
diff --git a/_includes/javascript.html b/_includes/javascript.html
index a2066c202809b465acc364e63211461f435bbc8f..ac8f16d0e04c6b79976ee5e533340e82f123d0e4 100644
--- a/_includes/javascript.html
+++ b/_includes/javascript.html
@@ -1,9 +1,9 @@
{% comment %}
Javascript used in lesson and workshop pages.
{% endcomment %}
-
-
-
+
+
+
|