From 9e5a8e6785d04164b6455d788b4beb6c05b4b0d7 Mon Sep 17 00:00:00 2001 From: BBaoVanC Date: Tue, 26 Oct 2021 14:27:37 -0500 Subject: [PATCH] Add `author` param and display it --- archetypes/blog/index.md | 1 + archetypes/default/index.md | 1 + exampleSite/config.toml | 5 ++++- layouts/partials/post-metadata.html | 7 +++++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/archetypes/blog/index.md b/archetypes/blog/index.md index 65fc64f..2a2c56e 100644 --- a/archetypes/blog/index.md +++ b/archetypes/blog/index.md @@ -2,6 +2,7 @@ title: {{ replace .Name "-" " " | title }} date: {{ .Date | time.Format "2006-01-02" }} +author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} toc: true comments: true draft: true diff --git a/archetypes/default/index.md b/archetypes/default/index.md index 9bd7542..1de9acb 100644 --- a/archetypes/default/index.md +++ b/archetypes/default/index.md @@ -1,6 +1,7 @@ --- title: {{ replace .Name "-" " " | title }} +author: {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }} menu: main toc: true comments: false diff --git a/exampleSite/config.toml b/exampleSite/config.toml index ba2abac..b0cbdb2 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,12 +1,15 @@ baseURL = "https://example.com" theme = "bobatheme" defaultContentLanguage = "en" -author = "bbaovanc" +copyright = '© 2021 bbaovanc CC BY-SA 4.0' sectionPagesMenu = "main" enableRobotsTXT = true paginate = 5 enableGitInfo = true +[author] + name = "bbaovanc" + [markup] [markup.highlight] noClasses = false diff --git a/layouts/partials/post-metadata.html b/layouts/partials/post-metadata.html index b63abe8..2f4f11d 100644 --- a/layouts/partials/post-metadata.html +++ b/layouts/partials/post-metadata.html @@ -20,6 +20,13 @@ {{ end }} {{ end }} + {{ with .Params.author }} + + {{ partial "icon.html" "user" }} + {{ . }} + + {{ end }} + {{ if .IsTranslated }} {{ partial "icon.html" "globe" }}