Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/joway/hugo-theme-yinyang.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <misha.brukman@gmail.com>2021-01-14 08:02:27 +0300
committerGitHub <noreply@github.com>2021-01-14 08:02:27 +0300
commit0207ccaaa3cd07bbf10901ac4944e263a04b2019 (patch)
tree4e220dd38add6a2daae8aa0ddf858b509cf6cc9c
parentf30ce83dc00fb277fba848f8475a5c2c0b39c9c7 (diff)
Add (optional) support for Twitter Cards (#32)
This is a built-in feature of Hugo that we're enabling in the theme. Add `twitterCards = true` in the `[params]` section to enable it; for more info, see: https://gohugo.io/templates/internal/#twitter-cards
-rw-r--r--README.md12
-rw-r--r--layouts/partials/head.html3
2 files changed, 14 insertions, 1 deletions
diff --git a/README.md b/README.md
index b1316f9..8645c27 100644
--- a/README.md
+++ b/README.md
@@ -90,6 +90,18 @@ extraHead = '<script src="xxxx.js"></script>'
extraCSSFiles = ["css/foo.css", "css/bar.css"]
```
+### Twitter Cards
+
+Add the following setting:
+
+```
+[params]
+twitterCards = true
+```
+
+In a post's front matter, include a keyword `images` with a value of a list of
+URLs of images that will be used for Twitter Cards.
+
### Insert content on every post
```
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 3e12d4c..1636ed4 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -63,5 +63,6 @@
(function (undefined) { }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
</script> -->
+ {{ if .Site.Params.TwitterCards }}{{ template "_internal/twitter_cards.html" . }}{{ end }}
{{ .Site.Params.extraHead | safeHTML }}
-</head> \ No newline at end of file
+</head>