Add multilingual support

This commit is contained in:
Michal Pasierbski 2020-05-24 18:07:02 +02:00
parent 9d324b29a7
commit 3f5dced32f
5 changed files with 8 additions and 8 deletions

View File

@ -8,7 +8,7 @@
<ul class="terms">
{{ range $key, $value := .Data.Terms }}
<li>
<a href="{{ (print $.Data.Plural "/" (lower $key)) | absURL }}">
<a href="{{ (print $.Data.Plural "/" (lower $key)) | absLangURL }}">
{{ $key }}
</a>
({{ len $value }})

View File

@ -6,14 +6,14 @@
{{ if .Params.categories }}
<ul class="article-categories">
{{ range .Params.categories }}
<li><a href="{{ "categories/" | absURL }}{{ . }}">{{ . }}</a></li>
<li><a href="{{ "categories/" | absLangURL }}{{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}
{{ if .Params.tags }}
<ul class="article-tags">
{{ range .Params.tags }}
<li><a href="{{ "tags/" | absURL }}{{ . | urlize}}">#{{ . }}</a></li>
<li><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">#{{ . }}</a></li>
{{ end }}
</ul>
{{ end }}

View File

@ -1,9 +1,9 @@
<h1 class="site-header">
<a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
<a href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Title }}</a>
</h1>
<nav>
{{ $currentPage := . }}
{{ range .Site.Menus.main }}
<a class="{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL }}" title="{{ .Title }}">{{ .Name }}</a>
<a class="{{if or ($currentPage.IsMenuCurrent "main" .) ($currentPage.HasMenuCurrent "main" .) }} active{{end}}" href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</nav>

View File

@ -7,13 +7,13 @@
{{ if eq .Paginator.PageNumber 2 }}
<a href="{{ .Site.BaseURL }}{{ .Site.LanguagePrefix }}">{{ $toNewPostsMessage }}</a>
{{ else }}
<a href="{{ .Paginator.Prev.URL | absURL }}">{{ $toNewPostsMessage }}</a>
<a href="{{ .Paginator.Prev.URL | absLangURL }}">{{ $toNewPostsMessage }}</a>
{{ end }}
{{ end }}
</div>
<div class="right pagination-item {{ if not .Paginator.HasNext }}disabled{{ end }}">
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL | absURL }}">{{ $toOldPostsMessage }}</a>
<a href="{{ .Paginator.Next.URL | absLangURL }}">{{ $toOldPostsMessage }}</a>
{{ end }}
</div>
</div>

View File

@ -2,7 +2,7 @@
<h1>{{ i18n "category" | humanize }}: {{ .Title }}</h1>
<div class="article-info">
<a href="{{ "categories/" | absURL }}">{{ i18n "toAllCategories" | humanize }}</a>
<a href="{{ "categories/" | absLangURL }}">{{ i18n "toAllCategories" | humanize }}</a>
</div>
{{ range .Data.Pages }}
<article class="post-list">