Commit 351d1f55 authored by Kaushal Modi's avatar Kaushal Modi

Add support for series taxonomy

parent eb290511
......@@ -21,6 +21,8 @@
</div>
{{ end }}
{{ partial "series.html" . }}
{{ partial "headline-hash.html" .Content }}
<!-- Print versions at the end of the post, if specified. -->
......
<!-- https://npf.io/2014/08/making-it-a-series/ -->
<!-- This must be called only in single type layouts. -->
<!--
Site config needs to have "series" along with "tag" and "category" if you need
those too:
[Taxonomies]
category = "categories" # SINGULAR = "PLURAL"
tag = "tags"
series = "series"
-->
{{ if (not .Date.IsZero) }} <!-- The date *must* be set for a series post -->
{{ $this_page_permalink := .Permalink }}
{{ with .Params.series }}
{{ $this_series := index . 0 }} <!-- Assuming that the front-matter series param is a list with just 1 element -->
<!--
$.Site.Taxonomies.series then is a map with key = "urlized value
of the series name", and value = WeightedPages object. The
WeightedPages object holds a list of WeightedPage objects.
-->
{{ $weighted_pages := index $.Site.Taxonomies.series ($this_series | urlize) }}
<!-- It does not make sense to show the "series block" if that series has just one post. -->
{{ if (ge $weighted_pages.Count 2) }}
<div class="series">
<p>
<a href="" id="series"></a>
This is a post in the “<b>{{ $this_series }}</b>” series.
</p>
<ul>
<!-- Calling .Pages function on the WeightedPages object will return all the nested pages. -->
{{ range $weighted_pages.Pages }}
{{ if (not .Date.IsZero) }} <!-- The date *must* be set for a series post -->
{{ $date := printf "<span class=\"series-date\">%s</span>" (.Date.Format "Jan 02, 2006") | safeHTML }}
{{ if (eq $this_page_permalink .Permalink) }}
<!-- Don't hyperlink the current-page series element. -->
<li>{{ $date }} - {{ .Title }}</li>
{{ else }}
<li>{{ $date }} - <a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
{{ end }}
{{ end }} <!-- ends range -->
</ul>
</div>
<br />
{{ end }} <!-- ends if count -->
{{ end }} <!-- ends with -->
{{ end }}
......@@ -79,6 +79,7 @@
--theme-color: #ac4142;
--theme-color-light: rgba(172, 65, 66, 0.2); /* Same as the --theme-color #ac4142, but in decimal, with 20% opacity */
--grey: #515151;
--grey-light: rgba(81, 81, 81, 0.5); /* Same as the --grey color #515151, but in decimal, with 50% opacity */
--title-heading-color: #212121;
--blinking-cursor-color: #212121;
--theme-color-highlight: #fffbcc; /* http://www.ianoxley.com/blog/2010/03/15/that-yellow-highlight-colour-in-rgb-and-hex */
......@@ -1141,8 +1142,7 @@ blockquote {
.content h4::before,
.content h5::before,
.content h6::before {
color: var(--grey);
opacity: 0.5;
color: var(--grey-light);
font-size: 1.5em;
vertical-align: -30%;
}
......@@ -2180,6 +2180,15 @@ pre code.language-xml::before { content: 'XML'; }
margin-right: -0.15em;
}
/* Series */
div.series {
padding-top: 10px;
padding-left: 20px;
padding-right: 20px;
border: 1px solid var(--grey-light);
border-radius: 6px;
}
/* * Footer */
footer {
font-size: 0.9em;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment