diff options
author | Kaito Sugimoto <hellorusk1998@gmail.com> | 2022-09-30 03:03:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 03:03:32 +0300 |
commit | 2174285f03fb435e4202c98e23eb216b32cc89fe (patch) | |
tree | a2d5576feafe3106feed657564c0a4095d1591e6 | |
parent | 9094304e08c4ea1a538813e2b7656bd916fb2863 (diff) | |
parent | aa2d650e7f380ba8075922bc74a2597a850b1e78 (diff) |
Merge pull request #10 from daenney/daenney/twitter-opengraph
Add support for Twitter Card and Opengraph
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | layouts/partials/head.html | 6 |
2 files changed, 18 insertions, 0 deletions
@@ -52,6 +52,18 @@ footnoteReturnLinkContents = "^" darkmode = true # set true if you prefer dark mode ``` +### Social media + +If you want to enable the generation of Twitter Card or Opengraph `meta` tags so you get nice embeds on Twitter, Facebook and other social media sites, add the following: + +```toml +[Params] + twittercard = true + opengraph = true +``` + +See the [Internal Templates](https://gohugo.io/templates/internal/) in Hugo for how to configure this behaviour further. + ## Shortcodes ### Sidenotes diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 122efd2..630b4b4 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -12,6 +12,12 @@ {{- end }} <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> +{{ if site.Params.twittercard }} +{{ template "_internal/twitter_cards.html" . }} +{{- end }} +{{ if site.Params.opengraph }} +{{ template "_internal/opengraph.html" . }} +{{- end }} <link rel="stylesheet" href="{{ .Site.BaseURL }}css/latex.css" /> <link rel="stylesheet" href="{{ .Site.BaseURL }}css/main.css" /> {{ if site.Params.darkmode }} |