diff options
author | Stephen Siegert <stephen.siegert@sas.com> | 2019-02-15 23:26:48 +0300 |
---|---|---|
committer | Stephen Siegert <stephen.siegert@sas.com> | 2019-02-15 23:26:48 +0300 |
commit | a41e1111dbc3a5b6f19eeda14829204f92dad64f (patch) | |
tree | ba8ff4996149d6466bf250dd5612d9be6128301c | |
parent | e6e0aa7f96ba81ca01f04212706fdd6943ca8b13 (diff) |
add series taxonomy and update single.html to accomodate
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 5 | ||||
-rw-r--r-- | layouts/_default/single.html | 37 | ||||
-rw-r--r-- | layouts/taxonomy/series.html | 38 |
4 files changed, 77 insertions, 4 deletions
@@ -6,6 +6,7 @@ Basic personal site theme styled with minimal tachyons. - ✨ Basic — HTML with a dash of style + emojis stand out more - 🌯 Extensible — Easily leverage [tachyons](https://tachyons.io/components/) to spice it up +- 🗞️ `series` Taxonomy - Automatically group posts and display within an isolated taxonomy type - 🥑 Syntax Highlighting - When you get the urge to code ### Index diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9d5a272..5924b89 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -6,6 +6,11 @@ googleAnalytics = "" enableEmoji = true copyright = "© 2016-19 Example" +[taxonomies] + category = "categories" + series = "series" + tag = "tags" + [params] titleEmoji = ":tada:" twitter = "exampleHandle" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 2c5911a..eb34eb1 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -14,15 +14,44 @@ <section id="main" class="mt5"> <h1 itemprop="name" id="title">{{ .Title }}</h1> <span class="f6 gray">{{ .Date.Format "January 2, 2006" }}</span> - + <article itemprop="articleBody" id="content" class="w-90 lh-copy"> {{ .Content }} </article> - <span class="f6 gray mt3" title="Lastmod: {{ .Lastmod.Format "January 2, 2006" }}. Published at: {{ .PublishDate.Format "2006-01-02" }}."> - {{ if ne .Lastmod .PublishDate }} - Modified : {{ dateFormat "January 2, 2006" .Lastmod }} + {{ if and (.Site.Taxonomies.series) (isset .Params "series") }} + <section class="mt4"> + {{ $readMore := ":wave:" }} + {{ $series := .Params.series | urlize}} + <h3>{{ $readMore | emojify }} Related posts in the <a href="/series/{{ $series }}" class="b bb bw1 pb1 no-underline black">{{ .Params.Series }}</a> series...</h3> + + {{ $posts := index .Site.Taxonomies.series $series }} + + {{ if (gt ($posts | len) 1)}} + <ul class="list pl0"> + {{ range where $posts "Title" "!=" .Title }} + <li class="list pl0 lh-copy"> + <a + class="f4 b dib black no-underline" + href="{{ .Permalink}}" + >{{ .Title }}</a + > + <span class="f6 gray">{{ .Date.Format "January 2, 2006" }}</span> + </li> + {{ end }} + </ul> + {{ else }} + <div class="ph2 i"> + No follow up posts yet. Check back soon! + </div> {{ end }} + </section> + {{ end }} + + <span class="f6 gray mt3" title="Lastmod: {{ .Lastmod.Format "January 2, 2006" }}. Published at: {{ .PublishDate.Format "2006-01-02" }}."> + {{ if ne .Lastmod .PublishDate }} + Modified : {{ dateFormat "January 2, 2006" .Lastmod }} + {{ end }} </span> </section> diff --git a/layouts/taxonomy/series.html b/layouts/taxonomy/series.html new file mode 100644 index 0000000..15eadd7 --- /dev/null +++ b/layouts/taxonomy/series.html @@ -0,0 +1,38 @@ +{{ partial "header.html" . }} +<body + lang="{{ .Site.LanguageCode }}" + class="sans-serif w-90 w-60-ns center center-ns mv2 mv5-ns" +> + <span class="b">/ </span> + <a + href="{{ .Site.BaseURL }}" + class="b bw1 bb pb1 no-underline black" + >{{ .Site.Title }}</a + > + <span class="b"> / </span> + <a href="/series" class="b bw1 bb pb1 no-underline black">series</a> + <span class="b"> / </span> + <!-- prettier-ignore --> + <span class="b pb1 no-underline black">{{ .Title | lower }}</span> + + <section id="main" class="mt5"> + <div> + <ul id="list" class="pl0"> + <!-- prettier-ignore --> + {{ range .Data.Pages.ByPublishDate }} + <li class="list pl0 lh-copy"> + <a + class="f3 b dib black no-underline" + href="{{ .Permalink}}" + >{{ .Title }}</a + > + <span class="f6 gray">{{ .Date.Format "January 2, 2006" }}</span> + </li> + <!-- prettier-ignore --> + {{ end }} + </ul> + </div> + </section> + + {{ partial "footer.html" . }} +</body> |