Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/toryanderson/hugo-icarus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Roche <didrocks@ubuntu.com>2016-12-19 21:10:31 +0300
committerdigitalcraftsman <digitalcraftsman@protonmail.com>2016-12-22 20:32:45 +0300
commitaa7de60ef99ca2e05c760f3f1bd0be89593404eb (patch)
tree5ad58ef4100e0174fc0422efacf5798a4aac028a /layouts
parent8d7dd851703fcddf0c89f774265caf24cdfeade3 (diff)
Fix tags and categories links when reading a post
Tags and categories links in article header were relative to current page, which works well when people are on the homepage. However, when you are in a blog post (/post/<…>), then, it's appended to it and ends up as /post/<…>/tags/foo for instance, leading to a 404. Add a / in front of links and be always relative to the baseurl of the website.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/article_header.html8
1 files changed, 4 insertions, 4 deletions
diff --git a/layouts/partials/article_header.html b/layouts/partials/article_header.html
index b70d5a3..e7acf9e 100644
--- a/layouts/partials/article_header.html
+++ b/layouts/partials/article_header.html
@@ -23,8 +23,8 @@
<div class="article-category">
<i class="fa fa-folder"></i>
{{ range $k, $v := .Params.categories }}
- {{ $url := printf "%s/%s" "categories" (. | urlize | lower) }}
- <a class="article-category-link" href="{{ $url }}">{{ . }}</a>
+ {{ $url := printf "categories/%s" (. | urlize | lower) }}
+ <a class="article-category-link" href="{{ $url | absURL }}">{{ . }}</a>
{{ if lt $k (sub $categoriesLen 1) }}&middot;{{ end }}
{{ end }}
</div>
@@ -37,8 +37,8 @@
<div class="article-category">
<i class="fa fa-tags"></i>
{{ range $k, $v := .Params.tags }}
- {{ $url := printf "%s/%s" "tags" (. | urlize | lower) }}
- <a class="article-category-link" href="{{ $url }}">{{ . }}</a>
+ {{ $url := printf "tags/%s" (. | urlize | lower) }}
+ <a class="article-category-link" href="{{ $url | absURL }}">{{ . }}</a>
{{ if lt $k (sub $tagsLen 1) }}&middot;{{ end }}
{{ end }}
</div>