diff options
author | Austin Gebauer <agebauer@hashicorp.com> | 2020-04-05 21:23:46 +0300 |
---|---|---|
committer | Austin Gebauer <agebauer@hashicorp.com> | 2020-04-05 21:23:46 +0300 |
commit | d97bc710772a58b28bd9e07f2b090d6f2193316c (patch) | |
tree | 9bac2d25753d6fad74c61db6b1c3a2da78997caf | |
parent | ad1d38fb45589612218cbe4d0c934dd59654b033 (diff) |
feat: parameterize header and footer; feat: use mainSections for recent posts
-rw-r--r-- | layouts/partials/category-posts.html | 37 | ||||
-rw-r--r-- | layouts/partials/footer.html | 7 | ||||
-rw-r--r-- | layouts/partials/header.html | 12 |
3 files changed, 34 insertions, 22 deletions
diff --git a/layouts/partials/category-posts.html b/layouts/partials/category-posts.html index c89e970..a6a1c87 100644 --- a/layouts/partials/category-posts.html +++ b/layouts/partials/category-posts.html @@ -2,38 +2,37 @@ <div class="row"> <div class="col-12"> {{ $recent := 7 }} - {{ if .Site.Params.recent_posts }} + {{ if isset .Site.Params "recent_posts" }} {{ $recent = .Site.Params.recent_posts }} {{ end }} - <div class="pb-3"> <h5><span class="badge category">Recent</span></h5> <ul class="list-unstyled"> - {{ range first $recent (where .Site.RegularPages "Type" "posts" ) }} - <li> - {{ .Date.Format "Jan 2 2006" }} - <a href="{{ .Permalink }}">{{ .Title }}</a> - </li> + {{ range first $recent (where .Site.RegularPages "Type" "in" site.Params.mainSections) }} + <li> + {{ .Date.Format "Jan 2 2006" }} + <a href="{{ .Permalink }}">{{ .Title }}</a> + </li> {{ end }} </ul> </div> {{ range $key, $taxonomy := .Site.Taxonomies.categories.Alphabetical }} - <div class="pb-3"> - <h5> + <div class="pb-3"> + <h5> <span class="badge category text-capitalize"> {{ .Name | humanize }} </span> - </h5> - <ul class="list-unstyled"> - {{ range $taxonomy.Pages }} - <li> - {{ .Date.Format "Jan 2 2006" }} - <a href="{{ .Permalink }}">{{ .Title }}</a> - </li> - {{ end }} - </ul> - </div> + </h5> + <ul class="list-unstyled"> + {{ range $taxonomy.Pages }} + <li> + {{ .Date.Format "Jan 2 2006" }} + <a href="{{ .Permalink }}">{{ .Title }}</a> + </li> + {{ end }} + </ul> + </div> {{ end }} </div> </div> diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a279f15..fd2fa67 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,6 +1,11 @@ <footer class="text-center pb-1"> <small class="text-muted"> - {{ .Site.Params.footer_text | safeHTML }}<br> + {{ if isset .Site.Params "footer_text" }} + {{ .Site.Params.footer_text | safeHTML }} + {{ else }} + {{ "© Copyright Year, Your Name" | safeHTML }} + {{ end }} + <br> Powered by <a href="https://github.com/austingebauer/devise" target="_blank">Devise</a> </small> </footer> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 1a7a325..8cd8bd2 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -18,11 +18,19 @@ <div class="col-sm-8 col-12 text-sm-left text-center"> <h2 class="m-0 mb-2 mt-4"> <a href="/" class="text-decoration-none"> - {{ .Site.Params.header_title }} + {{ if isset .Site.Params "header_title" }} + {{ .Site.Params.header_title }} + {{ else }} + Your Name + {{ end }} </a> </h2> <p class="text-muted mb-1"> - {{ .Site.Params.header_subtitle }} + {{ if isset .Site.Params "header_subtitle" }} + {{ .Site.Params.header_subtitle }} + {{ else }} + Your Subtitle Text + {{ end }} </p> <ul id="nav-links" class="list-inline mb-2"> {{ $currentPage := . }} |