From 6c2cca012758803802a81d06dccb60c2d2d48b66 Mon Sep 17 00:00:00 2001 From: Anthony Vanegas Date: Thu, 27 Aug 2020 08:45:50 -0400 Subject: [PATCH] Support custom homepage greeting message (#66) * Support custom greeting message in homepage Co-authored-by: Emruz Hossain --- README.md | 2 ++ exampleSite/config.yaml | 2 ++ layouts/partials/sections/home.html | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 24b665e..0113569 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 47a59cb..a268aed 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -66,6 +66,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/layouts/partials/sections/home.html b/layouts/partials/sections/home.html index 2f825a7..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 }}
-

Hi, I am - {{ 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 }}