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

github.com/shaform/hugo-theme-den.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaform <shaform@gmail.com>2018-11-17 06:15:54 +0300
committerShaform <shaform@gmail.com>2018-11-17 06:15:54 +0300
commita6624c4dd9c120c105e4852f4dfa5e5723be45ad (patch)
tree4402080acb97d2da7a667b2c97333af9a622b783
parent0ebd7323f87e083cfa957801c5a4849f120b0527 (diff)
fix bug and add example
-rw-r--r--exampleSite/config.toml1
-rw-r--r--exampleSite/content/en/posts/note-1.md2
-rw-r--r--exampleSite/content/zh-tw/posts/note-1.md2
-rw-r--r--exampleSite/data/authors/bob.toml13
-rw-r--r--layouts/posts/single.html4
5 files changed, 19 insertions, 3 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index cef1ffe..e5a73c8 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -62,6 +62,7 @@ defaultContentLanguageInSubdir = true
siteLogoImage = "images/globe.svg" # shown besides logoTitle
# headerTitle = "Den" # default: title
headerImage = "images/background.jpg"
+ showAuthorCard = true # Whether to show author information below the article
showMenuLanguages = true
diff --git a/exampleSite/content/en/posts/note-1.md b/exampleSite/content/en/posts/note-1.md
index 1d98f73..e993803 100644
--- a/exampleSite/content/en/posts/note-1.md
+++ b/exampleSite/content/en/posts/note-1.md
@@ -6,7 +6,7 @@ draft: false
tags: ["notes"]
categories: ["Notes"]
authors:
-- "Shaform"
+- bob
---
This is a simple note.
diff --git a/exampleSite/content/zh-tw/posts/note-1.md b/exampleSite/content/zh-tw/posts/note-1.md
index d1e21df..b74bc7e 100644
--- a/exampleSite/content/zh-tw/posts/note-1.md
+++ b/exampleSite/content/zh-tw/posts/note-1.md
@@ -6,7 +6,7 @@ draft: false
tags: ["notes"]
categories: ["Notes"]
authors:
-- "Shaform"
+- bob
---
這是一個簡單的筆記。
diff --git a/exampleSite/data/authors/bob.toml b/exampleSite/data/authors/bob.toml
new file mode 100644
index 0000000..355f6da
--- /dev/null
+++ b/exampleSite/data/authors/bob.toml
@@ -0,0 +1,13 @@
+url = "https://example.com"
+
+[name]
+display = "Bob"
+
+[image]
+# url = ""
+
+[zh-tw]
+description = "自我簡介。"
+
+[en]
+description = "Self introduction."
diff --git a/layouts/posts/single.html b/layouts/posts/single.html
index 8f42523..ea1aecb 100644
--- a/layouts/posts/single.html
+++ b/layouts/posts/single.html
@@ -9,7 +9,9 @@
{{- $last := (sub (len .Params.authors) 1) -}}
{{- i18n "author_by" }}
{{ range $index, $value := .Params.authors -}}
- {{ (index (index $.Site.Data.authors $value) $.Site.LanguageCode).name.display | default (index $.Site.Data.authors $value).name.display | default $value }}{{ if ne $index $last }}, {{ end -}}
+ {{- $author := index $.Site.Data.authors $value -}}
+ {{- $author_lang := index ($author | default $.Site.Data.authors) $.Site.LanguageCode | default $author -}}
+ {{ $author_lang.name.display | default $value }}{{ if ne $index $last }}, {{ end -}}
{{ end }} /
{{ end }}
{{ .Date.Format (.Site.Params.dateFormatToUse | default "Mon 02 January 2006") -}}