From 3eaf93dd8acd0cec4cff434f294ad076b499d665 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Fri, 12 Mar 2021 21:27:30 +0000
Subject: [PATCH] Made defining of taxonomy conditional
---
exampleSite/config.toml | 4 ----
layouts/partials/head.html | 5 +++++
README.md | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/README.md b/README.md
index 85248dc..307dc7d 100644
--- a/README.md
+++ b/README.md
@@ -310,7 +310,7 @@
```
### Open Graph Support
-The [internal template for Open Graph protocol](https://gohugo.io/templates/internal/#open-graph) uses a mix of configuration variables; settings in `config.toml` and frontmatter of the page.
+The [internal template for Open Graph protocol](https://gohugo.io/templates/internal/#open-graph) uses a mix of configuration variables; settings in `config.toml` and frontmatter of the page. In a nutshell, you will have to configure a taxonomies series.
### Post Thumbnails
Thumbnails can be enabled easily by setting the `thumbnail` parameter in the frontmatter of a post to an image such as `"images/landscape.jpg"`.
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 13b613d..4782677 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -99,7 +99,3 @@
weight = 400
identifier = "contact"
url = "/contact/"
-
-## Taxonomies for Opengraph
-[taxonomies]
- series = "series"
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index e98ba73..07d1daa 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -96,5 +96,10 @@
{{ template "_internal/twitter_cards.html" . }}
<!-- Open Graph -->
+ {{- if isset .Site.Taxonomies "series" }}
+ {{- if not (eq (len .Site.Taxonomies.series) 0) -}}
{{ template "_internal/opengraph.html" . }}
+ {{- end -}}
+ {{- end }}
+
</head>
--
Gitblit v1.10.0