diff options
author | Misha Brukman <misha.brukman@gmail.com> | 2021-01-14 08:02:27 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 08:02:27 +0300 |
commit | 0207ccaaa3cd07bbf10901ac4944e263a04b2019 (patch) | |
tree | 4e220dd38add6a2daae8aa0ddf858b509cf6cc9c | |
parent | f30ce83dc00fb277fba848f8475a5c2c0b39c9c7 (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.md | 12 | ||||
-rw-r--r-- | layouts/partials/head.html | 3 |
2 files changed, 14 insertions, 1 deletions
@@ -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> |