Skip to content

Commit

Permalink
Support custom homepage greeting message (hugo-toha#66)
Browse files Browse the repository at this point in the history
* Support custom greeting message in homepage
Co-authored-by: Emruz Hossain <[email protected]>
  • Loading branch information
tkepassport39 committed Aug 27, 2020
1 parent 979d6a4 commit 6c2cca0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]"
Expand Down
2 changes: 2 additions & 0 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "[email protected]"
Expand Down
20 changes: 11 additions & 9 deletions layouts/partials/sections/home.html
Original file line number Diff line number Diff line change
@@ -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 }}
<div class="container-fluid home" id="home">
<div
class="background container-fluid"
Expand All @@ -7,15 +17,7 @@
<img src="{{ if .Site.Params.author.image }}{{ .Site.Params.author.image }}{{ else }}/assets/images/default-avatar.png{{ end }}"
class="rounded-circle mx-auto d-block img-fluid"
/>
<h1 class="greeting">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 }}
</h1>
<h1 class="greeting"> {{ $greeting }} {{ $name }}</h1>
<div class="typing-carousel">
<span id="ityped" class="ityped"></span>
<span class="ityped-cursor"></span>
Expand Down

0 comments on commit 6c2cca0

Please sign in to comment.