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

github.com/xianmin/hugo-theme-jane.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaform <shaform@gmail.com>2018-07-17 09:16:15 +0300
committerShaform <shaform@gmail.com>2018-07-18 09:37:28 +0300
commit688420336bf842f7a4e12263f8edc94ed7861dfd (patch)
tree7dcb01fcf4715ab5b94d1bc9808982519588a0a7
parentb2548bd81d7e8de3cad43487d4312681e8bb727f (diff)
remove hardcoded URLs for tags/categories
-rw-r--r--layouts/_default/terms.html21
-rw-r--r--layouts/post/single.html10
-rw-r--r--layouts/post/summary.html5
3 files changed, 26 insertions, 10 deletions
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index ee18a72..dd0de30 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -4,22 +4,26 @@
{{ $termName := .Data.Plural }}
{{ $terms := .Data.Terms.ByCount }}
{{ $length := len $terms }}
+ {{ $type := .Type }}
<!-- Categories Page -->
{{ if and $.Site.Taxonomies.categories (eq $termName "categories") }}
- {{ range $key, $value := $terms }}
+ {{ range $terms }}
+ {{ $term := .Term }}
+ {{ $pages := .Pages }}
+ {{ with $.Site.GetPage "taxonomy" $type $term }}
<section id="archive" class="archive">
<div class="archive-title">
</div>
<div class="collection-title">
<h2 class="archive-year">
- <a href="{{ $termName | urlize | relLangURL }}/{{ $value.Term | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}">
- {{ i18n "category" }}{{ $value.Term }}
+ <a href="{{ .Permalink }}">
+ {{ i18n "category" }}{{ $term }}
</a>
</h2>
</div>
- {{ range first 5 $value.Pages }}
+ {{ range first 5 $pages }}
<div class="archive-post">
<span class="archive-post-time">
{{ .Date.Format "2006-01-02" }}
@@ -31,13 +35,14 @@
</span>
</div>
{{ end }}
- {{ if gt (len $value.Pages) 5 }}
+ {{ if gt (len $pages) 5 }}
<div class="more-post">
- <a href="{{ $termName | urlize | relLangURL }}/{{ $value.Term | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}" class="more-post-link">{{ i18n "morePost" }}</a>
+ <a href="{{ .Permalink }}" class="more-post-link">{{ i18n "morePost" }}</a>
</div>
{{ end }}
</section>
{{ end }}
+ {{ end }}
<!-- Tag cloud Page -->
{{ else if and $.Site.Taxonomies.tags (eq $termName "tags") }}
@@ -61,9 +66,11 @@
{{ $count := len $taxonomy.Pages }}
{{ $weigth := div (sub (math.Log $count) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
{{ $currentFontSize := (add $smallestFontSize (mul (sub $largestFontSize $smallestFontSize) $weigth) ) }}
+ {{ with $.Site.GetPage "taxonomy" $type $tagName }}
<!--Current font size: {{$currentFontSize}}-->
- <a href="{{ $termName | urlize | relLangURL }}/{{ $tagName | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}"
+ <a href="{{ .Permalink }}"
style="font-size:{{$currentFontSize}}{{$fontUnit}}">{{ $tagName }}</a>
+ {{ end }}
{{ end }}
</div>
</div>
diff --git a/layouts/post/single.html b/layouts/post/single.html
index a6fdb5d..60286e2 100644
--- a/layouts/post/single.html
+++ b/layouts/post/single.html
@@ -10,7 +10,10 @@
{{ with .Params.categories -}}
<div class="post-category">
{{ range . }}
- <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}"> {{ . }} </a>
+ {{- $name := . -}}
+ {{- with $.Site.GetPage "taxonomy" "categories" $name -}}
+ <a href="{{ .Permalink }}"> {{ $name }} </a>
+ {{ end -}}
{{ end }}
</div>
{{- end }}
@@ -39,7 +42,10 @@
{{ with .Params.tags -}}
<div class="post-tags">
{{ range . }}
- <a href="{{ "tags" | relLangURL }}/{{ . | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}">{{ . }}</a>
+ {{- $name := . -}}
+ {{- with $.Site.GetPage "taxonomy" "tags" $name -}}
+ <a href="{{ .Permalink }}">{{ $name }}</a>
+ {{ end -}}
{{ end }}
</div>
{{- end }}
diff --git a/layouts/post/summary.html b/layouts/post/summary.html
index bf2cfd9..fd5b6c0 100644
--- a/layouts/post/summary.html
+++ b/layouts/post/summary.html
@@ -7,7 +7,10 @@
{{ with .Params.categories -}}
<div class="post-category">
{{ range . }}
- <a href="{{ "categories" | relLangURL }}/{{ . | urlize }}{{if $.Site.Params.uglyURLs}}.html{{else}}/{{end}}"> {{ . }} </a>
+ {{- $name := . -}}
+ {{- with $.Site.GetPage "taxonomy" "categories" $name -}}
+ <a href="{{ .Permalink }}"> {{ $name }} </a>
+ {{ end -}}
{{ end }}
</div>
{{- end }}