From d530d03761514d90de059ca005063d447f50460c Mon Sep 17 00:00:00 2001
From: Kenneth <schabrechts.k@gmail.com>
Date: Sun, 15 Aug 2021 14:01:29 +0000
Subject: [PATCH] feat: Adding series to the theme
---
layouts/_default/single.html | 5 ++
layouts/partials/series.html | 10 +++++
exampleSite/content/english/post/series-part-2.md | 17 ++++++++
exampleSite/config/_default/config.toml | 7 +++
exampleSite/content/english/post/series-part-1.md | 41 ++++++++++++++++++++
README.md | 22 +++++++++++
6 files changed, 101 insertions(+), 1 deletions(-)
diff --git a/README.md b/README.md
index a37d61f..18dfa72 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@
- Compliant to strict CSP
- Syntax highlighting
- Uses Hugo pipes to process assets
+- Series
## Preview the exampleSite
@@ -637,6 +638,27 @@
Please note that only "## H2 Headings" and "### H3 Headings" will appear in the table of contents.
+### Enabling Series
+
+You can enable series, which allows splitting up a huge post into a set of multiple blog posts that are still linked. This would also provide a unique link to the full series of blog posts. Each individual post in the series will also contain links to the other parts under the heading `Posts in this Series`.
+
+First, we need to enable the `series` taxonomy in the config.
+
+```toml
+[taxonomies]
+ category = "categories"
+ series = "series"
+ tag = "tags"
+```
+
+With this enabled, we can now proceed to specify the series in the Front Matter of each post of that series.
+
+```md
+series: - series-name
+```
+
+If you want to share the full series, you can do so by sharing the link `<base-url>/series/<series-name>`
+
## License
Anatole is licensed under the [MIT license](https://github.com/lxndrblz/anatole/blob/master/LICENSE).
diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml
index e6ee52e..c404a21 100644
--- a/exampleSite/config/_default/config.toml
+++ b/exampleSite/config/_default/config.toml
@@ -21,4 +21,9 @@
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
- unsafe=true
\ No newline at end of file
+ unsafe=true
+
+[taxonomies]
+ category = "categories"
+ series = "series"
+ tag = "tags"
diff --git a/exampleSite/content/english/post/series-part-1.md b/exampleSite/content/english/post/series-part-1.md
new file mode 100644
index 0000000..6d9e2de
--- /dev/null
+++ b/exampleSite/content/english/post/series-part-1.md
@@ -0,0 +1,41 @@
+---
+author: Hugo Authors
+title: Series Part 1
+date: 2021-08-14
+description: A brief guide to how to setup series part 1
+series:
+ - series-setup
+---
+
+In this first part of the series we'll show you how to create a series
+
+<!--more-->
+
+As a first step we need to add series as a taxonomy. We can do this by editing the `config.toml`.
+Note: We always need to define the existing taxonomies as well.
+
+```toml
+[taxonomies]
+ category = "categories"
+ series = "series"
+ tag = "tags"
+```
+
+Now we have the series enabled, the next thing we need to do is add the series name in the FrontMatter.
+For our example we'll use this post and the next part.
+
+As you can see we've set the series to `series-setup`. We also do the same in the next parts of the series.
+This end results should be a Front Matter that looks similar to this:
+
+```md
+---
+author: Hugo Authors
+title: Series Part 1
+date: 2021-08-14
+description: A brief guide to how to setup series part 1
+series:
+ - series-setup
+---
+```
+
+Each individual post will now also show the other posts in the series under the `Posts in this Series` heading.
diff --git a/exampleSite/content/english/post/series-part-2.md b/exampleSite/content/english/post/series-part-2.md
new file mode 100644
index 0000000..8a65463
--- /dev/null
+++ b/exampleSite/content/english/post/series-part-2.md
@@ -0,0 +1,17 @@
+---
+author: Hugo Authors
+title: Series Part 2
+date: 2021-08-15
+description: A brief guide to how to setup series part 2
+series:
+ - series-setup
+---
+
+In this second part of the series we'll show you where to find the full series
+
+<!--more-->
+
+When you created a series, you'll probably want to link to the full set of blogposts.
+In this example we used `series-setup` as our series name.
+
+This means we can now go to `http://localhost:1313/series/series-setup/` to see all the blog posts of this serie.
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index b4a20f1..5312dbb 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -45,6 +45,11 @@
{{ .Content }}
+ {{- if isset .Params "series" -}}
+ {{- partial "series.html" . -}}
+
+ {{- end -}}
+
{{- if (eq .Params.contact true) -}}
{{- partial "contact.html" . -}}
diff --git a/layouts/partials/series.html b/layouts/partials/series.html
new file mode 100644
index 0000000..380be46
--- /dev/null
+++ b/layouts/partials/series.html
@@ -0,0 +1,10 @@
+{{ $related := where .Site.RegularPages ".Params.series" "intersect" .Params.series }}
+
+
+<h3>Posts in this Series</h3>
+<ul>
+ {{ range $related }}
+ <li><a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a></li>
+
+ {{ end }}
+</ul>
--
Gitblit v1.10.0