From 9225ccd9aba2396d0b10d9e11718abb42dd2f294 Mon Sep 17 00:00:00 2001 From: Simon Li Date: Thu, 18 Jun 2020 20:47:20 +0100 Subject: add optional ogp and twitter meta tags --- README.md | 5 +++++ exampleSite/config.toml | 2 ++ exampleSite/layouts/partials/ogp.html | 7 +++++++ exampleSite/layouts/partials/twitter.html | 6 ++++++ layouts/partials/head.html | 6 ++++++ 5 files changed, 26 insertions(+) create mode 100644 exampleSite/layouts/partials/ogp.html create mode 100644 exampleSite/layouts/partials/twitter.html diff --git a/README.md b/README.md index 6ca38c0..7f21e6c 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,11 @@ description: "This is the subtext above the main heading in small letters" #### Overriding CSS To override CSS, you should create file `project_root/assets/css/override.css` and place all your CSS inside it. This file will be merged with standard CSS when the site is generated. +### Custom Meta Tags + +You can add optional Open Graph and Twitter meta tags by adding `project_root/layouts/partials/ogp.html` and `project_root/layouts/partials/twitter.html`. +Refer to [/exampleSite/layouts/partials](/exampleSite/layouts/partials) for sample meta configs. + ## Helpful Links [Aether Blog Post](https://www.joehutch.com/post/aether-theme/) - See aether in action and learn more about the theme diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 39af3b1..0c1f278 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -9,3 +9,5 @@ theme = "aether" brand = "aether" description = "aether Hugo theme for blogs" bgimg = "img/ignasi_pattern_s.png" +metaCreator = "Joe Hutchinson" +metaImage = "img/ogimage.jpg" diff --git a/exampleSite/layouts/partials/ogp.html b/exampleSite/layouts/partials/ogp.html new file mode 100644 index 0000000..d2164e8 --- /dev/null +++ b/exampleSite/layouts/partials/ogp.html @@ -0,0 +1,7 @@ + + + + + + + diff --git a/exampleSite/layouts/partials/twitter.html b/exampleSite/layouts/partials/twitter.html new file mode 100644 index 0000000..fc52000 --- /dev/null +++ b/exampleSite/layouts/partials/twitter.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 79eb808..0d319f7 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -19,6 +19,12 @@ {{ if (fileExists "static/safari-pinned-tab.svg") -}} {{ end -}} + {{ if (fileExists "layouts/partials/twitter.html") -}} + {{ partial "twitter.html" . }} + {{ end -}} + {{ if (fileExists "layouts/partials/ogp.html") -}} + {{ partial "ogp.html" . }} + {{ end -}} {{ $mainStyle := resources.Get "css/style.css" }} -- cgit v1.2.3