diff --git a/README.md b/README.md index 419791db..642d3c9b 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,7 @@ Search page: - Math typesetting - Menu - Minimal design +- Multiple authors - Multiple languages - RSS with full content - Responsive @@ -174,6 +175,12 @@ $ hugo server -D Optional site parameters: ```yaml +authors: + michael_bluth: + name: Michael Bluth + default: true # Credit this author in pages that have no authors parameter + george_bluth: + name: George Bluth paige: analytics: chartbeat: # chartbeat.com @@ -231,6 +238,10 @@ If you set either `hide_theme_comment` or `hide_theme_link`, please credit this Optional page parameters: ```yaml +authors: [ + "Michael Bluth", # Credit this name exactly + "george_bluth" # Credit the corresponding author name in the site parameters +] link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title paige: math: true # Enable math typesetting with KaTeX diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index 04d12a78..d7a3488b 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -1,6 +1,3 @@ -author: - email: example@example.com - name: Michael Bluth baseurl: https://example.com copyright: © Michael Bluth enablerobotstxt: true diff --git a/layouts/_default/home.html b/layouts/_default/home.html index fd77d2e1..d04231d3 100644 --- a/layouts/_default/home.html +++ b/layouts/_default/home.html @@ -2,7 +2,7 @@
{{ partial "paige-title.html" . }} {{ partial "paige-description.html" . }} - {{ partial "paige-date.html" . }} + {{ partial "paige-metadata.html" . }} {{ with .Params.stretch }}
{{ end }} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 8e95ad93..d2570cd7 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -42,7 +42,7 @@ {{ end }} {{ range $pages }} - {{ with .Site.Author.email }} + {{ with partial "paige-authors.html" . }} {{ . }} {{ end }} {{ if .Content }} @@ -58,7 +58,7 @@ {{ .Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} {{ end }} {{ with .Title }} - {{ . }} + {{ . | markdownify | plainify | htmlUnescape }} {{ end }} {{ end }} diff --git a/layouts/partials/paige-article.html b/layouts/partials/paige-article.html index 22faf0f6..16752139 100644 --- a/layouts/partials/paige-article.html +++ b/layouts/partials/paige-article.html @@ -1,6 +1,6 @@
{{ partial "paige-title.html" . }} {{ partial "paige-description.html" . }} - {{ partial "paige-date.html" . }} + {{ partial "paige-metadata.html" . }} {{ partial "paige-content.html" . }}
diff --git a/layouts/partials/paige-authors.html b/layouts/partials/paige-authors.html new file mode 100644 index 00000000..2febab76 --- /dev/null +++ b/layouts/partials/paige-authors.html @@ -0,0 +1,17 @@ +{{ $result := "" }} +{{ if .Params.authors }} + {{ $names := slice }} + {{ range .Params.authors }} + {{ $names = $names | append (index site.Params.authors . "name" | default .) }} + {{ end }} + {{ $result = delimit $names ", " }} +{{ else if .Site.Params.authors }} + {{ $names := slice }} + {{ range $k, $v := .Site.Params.authors }} + {{ if eq $v.default true }} + {{ $names = $names | append $v.name }} + {{ end }} + {{ end }} + {{ $result = delimit $names ", " }} +{{ end }} +{{ return $result }} diff --git a/layouts/partials/paige-date.html b/layouts/partials/paige-date.html deleted file mode 100644 index 1dc26bf3..00000000 --- a/layouts/partials/paige-date.html +++ /dev/null @@ -1,7 +0,0 @@ -{{ with .PublishDate }} -{{ $format := ":date_long" }} -{{ with site.Params.paige.date_format }} -{{ $format = . }} -{{ end }} -

-{{ end }} diff --git a/layouts/partials/paige-metadata.html b/layouts/partials/paige-metadata.html new file mode 100644 index 00000000..3a343acf --- /dev/null +++ b/layouts/partials/paige-metadata.html @@ -0,0 +1,8 @@ +{{ $authors := partial "paige-authors.html" . }} +{{ if or $authors .PublishDate}} +

+ {{- with $authors }}{{ . }}{{ end -}} + {{- if and $authors .PublishDate }}
{{ end -}} + {{- with .PublishDate }}{{ end -}} +

+{{ end }}