support Multilingual navigation

add reading time as i18n
This commit is contained in:
Aditya Telange 2020-08-25 01:40:02 +05:30
parent 04f9fabf92
commit e35915a561
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
7 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@
<div class="archive-meta">
{{- if or .Params.author .Site.Params.author }}{{- .Params.author | default .Site.Params.author }} ·
{{ end }}
{{ if $.Site.Params.ShowReadingTime }}{{ .ReadingTime }}{{ $.Site.Params.MinuteReadingTime | default "min read" }}
{{ if $.Site.Params.ShowReadingTime }}{{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}
· {{ end }}
{{- .Date.Format "January 2, 2006" -}}
</div>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<html lang="{{ .Site.Language }}">
<head>
{{- partial "head.html" . }}

View File

@ -52,7 +52,7 @@
<footer class="entry-footer">
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{ if $.Site.Params.ShowReadingTime }} .
{{ .ReadingTime }}{{ $.Site.Params.MinuteReadingTime | default "min read" }}{{ end }}
{{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}{{ end }}
{{ if or .Params.author .Site.Params.author }} . {{ .Params.author | default .Site.Params.author }}{{ end }}
</footer>
<a class="entry-link" href="{{ .Permalink }}"></a>

View File

@ -28,7 +28,7 @@
<footer class="entry-footer">
<time>{{ .Date.Format "January 2, 2006" }}</time>
{{ if $.Site.Params.ShowReadingTime }} .
{{ .ReadingTime }}{{ $.Site.Params.MinuteReadingTime | default "min read" }}{{ end }}
{{ .ReadingTime }}{{ i18n "read_time" | default "min read" }}{{ end }}
{{ if or .Params.author .Site.Params.author }} . {{ .Params.author | default .Site.Params.author }}{{ end }}
</footer>
<a class="entry-link" href="{{ .Permalink }}"></a>

View File

@ -31,7 +31,7 @@
{{- if .Params.tags }}
<ul class="post-tags">
{{- range .Params.tags }}
{{- $href := print (absURL "tags/") (urlize .) }}
{{- $href := print (absLangURL "tags/") (urlize .) }}
<li><a href="{{ $href }}">{{ . }}</a></li>
{{- end }}
</ul>

View File

@ -1,5 +1,5 @@
<footer class="footer">
<span>&copy; {{ now.Year }} <a href="{{ "" | absURL }}">{{ .Site.Title }}</a></span>
<span>&copy; {{ now.Year }} <a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></span>
<span>&middot;</span>
<span>Powered by <a href="https://gohugo.io/" rel="noopener" target="_blank">Hugo</a></span>
<span>&middot;</span>

View File

@ -6,15 +6,15 @@
{{- end -}}
<nav class="nav">
{{- if .IsHome }}
<h1 class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></h1>
<h1 class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></h1>
{{- else }}
<p class="logo"><a href="{{ "" | absURL }}">{{ .Site.Title }}</a></p>
<p class="logo"><a href="{{ "" | absLangURL }}">{{ .Site.Title }}</a></p>
{{- end }}
{{- if .Site.Menus.main }}
<ul class="menu" id="menu" onscroll="menu_on_scroll()">
{{- range .Site.Menus.main }}
<li>
<a href="{{ .URL }}">{{ .Name }}</a>
<a href="{{ .URL | absLangURL}}">{{ .Name }}</a>
</li>
{{- end }}
</ul>