From 3d3c9976e8c57d7927b641103a202d06bb1edb4a Mon Sep 17 00:00:00 2001 From: Emruz Hossain Date: Thu, 27 Aug 2020 18:41:12 +0600 Subject: [PATCH] Move greeting message under author field --- README.md | 2 ++ exampleSite/config.yaml | 7 ++----- layouts/partials/sections/home.html | 26 +++++++++++--------------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 001956e..c3ba094 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,8 @@ params: name: "Jane Doe" nickname: "Jane" image: "images/avatar.png" + # greeting message before your name. it will default to "Hi! I am" if not provided + greeting: "Hi, I am" # give your some contact information. they will be used in the footer contactInfo: email: "janedoe@example.com" diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index de3faf9..8c16fb1 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -60,16 +60,13 @@ params: newsletter: enable: true - # home page greeting message - # if empty it will default to "Hi, I am" - homeGreeting: - message: "" - # some information about you author: name: "Jane Doe" nickname: "Jane" image: "images/avatar.png" + # greeting message before your name. it will default to "Hi! I am" if not provided + greeting: "Hi, I am" # give your some contact information. they will be used in the footer contactInfo: email: "janedoe@example.com" diff --git a/layouts/partials/sections/home.html b/layouts/partials/sections/home.html index ad508e5..549079d 100644 --- a/layouts/partials/sections/home.html +++ b/layouts/partials/sections/home.html @@ -1,3 +1,13 @@ +{{ $greeting:="Hi! I am" }} +{{ if .Site.Params.author.greeting }} + {{ $greeting = .Site.Params.author.greeting }} +{{ end }} +{{ $name:="Jane Doe" }} +{{ if .Site.Params.author.nickname }} + {{ $name = .Site.Params.author.nickname }} +{{ else if .Site.Params.author.name }} + {{ $name = .Site.Params.author.name }} +{{ end }}
-

- {{ if .Site.Params.homeGreeting.message}} - {{ .Site.Params.homeGreeting.message}} - {{ else }} - Hi, I am - {{ end }} - - {{ if .Site.Params.author.nickname }} - {{ .Site.Params.author.nickname }} - {{ else if .Site.Params.author.name }} - {{ .Site.Params.author.name }} - {{ else }} - Jane Doe - {{ end }} -

+

{{ $greeting }} {{ $name }}