Skip to content

Commit

Permalink
use relLangURL (#335)
Browse files Browse the repository at this point in the history
for author, tags and categories
  • Loading branch information
tino-michael authored Nov 7, 2021
1 parent cd18522 commit f51ed13
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class="clearfix">
<p class="author-category">
{{ if isset .Params "authors" }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relLangURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ end }}
{{ if isset .Params "categories" }}
{{ if gt (len .Params.categories) 0 }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{ if or .Params.author .Params.date }}
<p class="text-muted text-uppercase mb-small text-right">
{{ if isset .Params "authors" }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relLangURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ end }}
{{ if and .Params.author .Params.date }} | {{ end }}
{{ if .Params.date }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/recent_posts.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ <h2>{{ .Site.Params.recent_posts.title | markdownify }}</h2>
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
<p class="author-category">
{{ if isset .Params "authors" }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ i18n "authorBy" }} {{ range $index, $author := .Params.authors }}{{ if $index }}, {{ end }}<a href="{{ (printf "%s/%s" ("authors" | relLangURL) ($author | urlize)) }}">{{ $author }}</a>{{ end }}
{{ end }}
{{ if .Params.date }}
{{ $createdAt := .Date.Format .Site.Params.date_format }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/widgets/categories.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h3 class="panel-title">{{ i18n "categoriesTitle" }}</h3>
{{ $current := . }}
{{ range $name, $items := .Site.Taxonomies.categories }}
<li{{ if eq $current.RelPermalink ($name | urlize | lower | printf "/categories/%s/") }} class="active"{{ end }}>
<a href="{{ "categories/" | relURL }}{{ $name | urlize | lower }}">{{ $name | upper }} ({{ len $items }})</a>
<a href="{{ "categories/" | relLangURL }}{{ $name | urlize | lower }}">{{ $name | upper }} ({{ len $items }})</a>
</li>
{{ end }}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/widgets/tags.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ <h3 class="panel-title">{{ i18n "tagsTitle" }}</h3>
<ul class="tag-cloud">
{{ $current := . }}
{{ range $name, $items := .Site.Taxonomies.tags }}
<li{{ if eq $current.RelPermalink ($name | urlize | lower | printf "/tags/%s/") }} class="active"{{ end }}>
<a href="{{ "tags/" | relURL }}{{ $name | urlize | lower }}"><i class="fas fa-tags"></i> {{ $name }}</a>
<li {{ if eq $current.RelPermalink (printf "%s/%s/" ("tags" | relLangURL) ($name | urlize | lower)) }}class="active"{{ end }}>
<a href="{{ "tags/" | relLangURL }}{{ $name | urlize | lower }}"><i class="fas fa-tags"></i> {{ $name }}</a>
</li>
{{ end }}
</ul>
Expand Down

0 comments on commit f51ed13

Please sign in to comment.