diff options
-rw-r--r-- | i18n/en.toml | 27 | ||||
-rw-r--r-- | layouts/_default/single.gmi | 4 | ||||
-rw-r--r-- | layouts/_default/single.html | 2 | ||||
-rw-r--r-- | layouts/index.gmi | 4 | ||||
-rw-r--r-- | layouts/index.html | 4 | ||||
-rw-r--r-- | layouts/partials/pageinfo.gmi | 4 | ||||
-rw-r--r-- | layouts/partials/pageinfo.html | 4 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.gmi | 8 | ||||
-rw-r--r-- | layouts/taxonomy/taxonomy.html | 8 | ||||
-rw-r--r-- | layouts/term/term.gmi | 8 | ||||
-rw-r--r-- | layouts/term/term.html | 8 |
11 files changed, 54 insertions, 27 deletions
diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..ddb5f1c --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,27 @@ +[readingTime] + one = "1 minute read" + other = "{{ .Count }} minutes read" + +[returnHome] + other = "Return to homepage" + +[list] + other = "List" + +[feeds] + other = "Feeds" + +[atomFeed] + other = "Atom Feed" + +[tags] + other = "Tags" + +[journalEntries] + other = "Journal Entries" + +[links] + other = "Links" + +[navLinks] + other = "Navigation Links" diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi index d038c3d..850d57e 100644 --- a/layouts/_default/single.gmi +++ b/layouts/_default/single.gmi @@ -1,6 +1,6 @@ {{ define "main" }} {{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} {{ if (.Page.Params.pageinfo | default true) }}{{ partial "pageinfo.gmi" . }} @@ -73,7 +73,7 @@ {{- if and (.Page.Params.makerefs | default true) $refs }} {{- $ref_index := 0 }} -## Links +## {{ i18n "links" }} {{- range $refs }} {{- $ref_index = add $ref_index 1 }} {{- $ref_text := index . 1 }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d0cc6a3..ec0ccbb 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,6 +1,6 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> {{- if (.Page.Params.pageinfo | default true) }} <p>{{ partial "pageinfo.html" . }}</p>{{ end }} diff --git a/layouts/index.gmi b/layouts/index.gmi index b97ef74..8ace600 100644 --- a/layouts/index.gmi +++ b/layouts/index.gmi @@ -6,11 +6,11 @@ {{ .Site.Params.indexIntro | safeHTML }} {{- end }} -## Navigation Links +## {{ i18n "navLinks" }} {{ range .Site.Menus.main -}} => {{ .URL }} {{ emojify ":link:" | safeHTML }} {{ .Name | safeHTML }} {{ end }} -## Journal Entries +## {{ i18n "journalEntries" }} {{ $entriesMinusOne := sub (len (where .Site.RegularPages.ByTitle "Section" "entry")) 1 -}} {{ range first $entriesMinusOne (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse -}} {{ partial "metadata.gmi" . }} diff --git a/layouts/index.html b/layouts/index.html index d29c86a..3161c49 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -6,7 +6,7 @@ {{- if .Site.Params.indexIntro }} <p>{{ .Site.Params.indexIntro }}</p> {{- end }} - <h2>Navigation Links</h2> + <h2>{{ i18n "navLinks" }}</h2> <nav> <ul class="list"> {{- range .Site.Menus.main }} @@ -14,7 +14,7 @@ {{- end }} </ul> </nav> - <h2>Journal Entries</h2> + <h2>{{ i18n "journalEntries" }}</h2> {{ range (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse -}} {{ partial "metadata.html" . -}} {{ end -}} diff --git a/layouts/partials/pageinfo.gmi b/layouts/partials/pageinfo.gmi index 7ec43ff..1c3df2c 100644 --- a/layouts/partials/pageinfo.gmi +++ b/layouts/partials/pageinfo.gmi @@ -1,2 +1,2 @@ -{{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }}
\ No newline at end of file +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} +{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate | time.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ i18n "readingTime" .ReadingTime }}{{ if .Page.Params.Tags }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}{{ $val }}{{ end }}
\ No newline at end of file diff --git a/layouts/partials/pageinfo.html b/layouts/partials/pageinfo.html index bba7c1c..ef64ef1 100644 --- a/layouts/partials/pageinfo.html +++ b/layouts/partials/pageinfo.html @@ -1,2 +1,2 @@ -{{ $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" -}} -{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ .Page.ReadingTime | safeHTML }} minute read{{ if .Page.Params.Tags }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := .Page.Params.Tags }}{{ if $key }}, {{ end }}<a class="link" href='{{ "/tags/" }}{{ . | urlize }}' rel="noreferrer">{{ $val }}</a>{{ end }} +{{ $dateFormat := .Site.Params.dateFormat | default ":date_long" -}} +{{ emojify ":calendar:" | safeHTML }} {{ .Page.PublishDate | time.Format $dateFormat | safeHTML }} | {{ emojify ":stopwatch:" | safeHTML }} {{ i18n "readingTime" .ReadingTime | safeHTML }}{{ if (.Param (lower (i18n "tags"))) }} | {{ emojify ":label:" | safeHTML }} {{ end }}{{ range $key, $val := (.Param (lower (i18n "tags"))) }}{{ if $key }}, {{ end }}<a class="link" href='{{ relLangURL (lower (i18n "tags")) }}/{{ . | urlize }}' rel="noreferrer">{{ $val }}</a>{{ end }} diff --git a/layouts/taxonomy/taxonomy.gmi b/layouts/taxonomy/taxonomy.gmi index 56b53a9..ecca4d8 100644 --- a/layouts/taxonomy/taxonomy.gmi +++ b/layouts/taxonomy/taxonomy.gmi @@ -1,12 +1,12 @@ {{ define "main" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} # {{ .Type | humanize }} -## Feeds -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} Atom Feed +## {{ i18n "feeds" }} +=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }} -## List +## {{ i18n "list" }} {{- range .Data.Pages }} => {{ .RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ .Title | safeHTML }} {{- end }} diff --git a/layouts/taxonomy/taxonomy.html b/layouts/taxonomy/taxonomy.html index a3a22a7..f1b5460 100644 --- a/layouts/taxonomy/taxonomy.html +++ b/layouts/taxonomy/taxonomy.html @@ -1,12 +1,12 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main> <h1>{{ .Type | humanize }}</h1> - <h2>Feeds</h2> - <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} Atom Feed</a></p> - <h2>List</h2> + <h2>{{ i18n "feeds" }}</h2> + <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}</a></p> + <h2>{{ i18n "list" }}</h2> <ul class="list"> {{- range .Data.Pages }} <li class="list__item">{{ emojify ":link:" }} <a class="link" href="{{ .RelPermalink }}" rel="noreferrer">{{ .Title }}</a></li> diff --git a/layouts/term/term.gmi b/layouts/term/term.gmi index d4c0d7d..fd8db55 100644 --- a/layouts/term/term.gmi +++ b/layouts/term/term.gmi @@ -1,12 +1,12 @@ {{ define "main" -}} -=> / {{ emojify ":link:" | safeHTML }} Return to homepage +=> {{ .Site.Home.RelPermalink | replaceRE `(?m)index.gmi$` "" }} {{ emojify ":link:" | safeHTML }} {{ i18n "returnHome" }} # {{ .Type | singularize | humanize | safeHTML }} "{{ .Title | safeHTML }}" -## Feeds -=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} Atom Feed +## {{ i18n "feeds" }} +=> {{ .RelPermalink | replaceRE `(?m)index.gmi$` "atom.xml" | safeHTML }} {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }} -## Journal Entries +## {{ i18n "journalEntries" }} {{ $entriesMinusOne := sub (len .Data.Pages) 1 -}} {{ range first $entriesMinusOne .Data.Pages.ByPublishDate.Reverse -}} {{ partial "metadata.gmi" . }} diff --git a/layouts/term/term.html b/layouts/term/term.html index 4b69ebe..4841673 100644 --- a/layouts/term/term.html +++ b/layouts/term/term.html @@ -1,12 +1,12 @@ {{ define "main" -}} <nav> - <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="/" rel="noreferrer">Return to homepage</a></p> + <p>{{ emojify ":link:" | safeHTML }} <a class="link" href="{{ .Site.Home.RelPermalink }}" rel="noreferrer">{{ i18n "returnHome" }}</a></p> </nav> <main> <h1>{{ .Type | singularize | humanize }} "{{ .Title }}"</h1> - <h2>Feeds</h2> - <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} Atom Feed</a></p> - <h2>Journal Entries</h2> + <h2>{{ i18n "feeds" }}</h2> + <p><a class="link" href="{{ print .RelPermalink "atom.xml" }}" rel="noreferrer"> {{ emojify ":link:" | safeHTML }} {{ i18n "atomFeed" }}</a></p> + <h2>{{ i18n "journalEntries" }}</h2> {{- range .Data.Pages.ByPublishDate.Reverse }} {{ partial "metadata.html" . -}} {{- end -}} |