summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exampleSite/config.toml6
-rw-r--r--layouts/partials/author.html9
-rw-r--r--layouts/partials/head.html7
3 files changed, 15 insertions, 7 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 4e0db0f..fe4c94a 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -6,9 +6,6 @@ resourceDir = "../resources"
defaultContentLanguage = "en"
-[Author]
- name = "John Doe"
-
[languages]
[languages.en]
weight = 1
@@ -16,6 +13,9 @@ defaultContentLanguage = "en"
languageDirection = "ltr"
[params]
+ # Site author name
+ author = "John Doe"
+ # author: ["Me", "You"] # multiple authors
# Site description. Used in meta description
description = "Ed is a Hugo theme designed for textual editors based on minimal computing principles, and focused on legibility and flexibility."
# Color scheme. Options: red, orange, magenta, cyan, blue, brown
diff --git a/layouts/partials/author.html b/layouts/partials/author.html
new file mode 100644
index 0000000..8f2758f
--- /dev/null
+++ b/layouts/partials/author.html
@@ -0,0 +1,9 @@
+{{- if or .Params.author site.Params.author }}
+{{- $author := (.Params.author | default site.Params.author) }}
+{{- $author_type := (printf "%T" $author) }}
+{{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
+{{- (delimit $author ", " ) }}
+{{- else }}
+{{- $author }}
+{{- end }}
+{{- end -}}
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index a3af22b..e7c14bd 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -5,21 +5,20 @@
{{ $description = .Site.Params.Description }}
{{- end -}}
- {{- $author := print .Site.Author.name -}}
- {{- if .Params.author -}}{{ $author = .Params.author }}{{- end }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1.0,shrink-to-fit=no">
<link rel="canonical" href="{{ .Permalink }}">
- <title>{{ block "title" . }}{{ with .Params.Title }}{{ . }} - {{ end }}{{ .Site.Title }}{{ end }}</title>
+ <title>{{ block "title" . }}{{ if .IsHome }}{{ .Site.Title }}{{ else }}{{ with .Params.Title }}{{ . }} - {{ end }}{{ .Site.Title }}{{ end }}{{ end }}</title>
<meta name="description" content="{{ $description }}">
+ <meta name="author" content="{{ (partial "author.html" . ) }}">
{{ hugo.Generator }}
<!-- Dublin Core metadata for Zotero -->
<meta property="dc:title" content="{{ .Title }}">
- <meta property="dc:creator" content="{{ $author }}">
+ <meta property="dc:creator" content="{{ (partial "author.html" . ) }}">
<meta property="dc:identifier" content="{{ .Permalink }}">
{{- if .Params.editor }}<meta property="dc:contributor" content="{{ .Params.editor }}">{{ end }}
{{- if .Params.date }}<meta property="dc:date" content="{{ .Params.date }}">{{ end }}