From dbc3062d24742ebaffa409a747b93ad80001897f Mon Sep 17 00:00:00 2001 From: Salim B Date: Sat, 26 Oct 2019 21:48:58 +0200 Subject: improve meta tags: (#212) * add og:locale meta tag * improve meta tags: - fix `author` and `og:url` meta tags - add missing (Facebook) Open Graph meta tags - add `og:locale` - add `og:updated_time` - make `og:type` an `article` for blog posts (instead of `website`) - add `article:` meta tags for blog posts (use the first category of blog posts for `article:section`) - add `og:image:type` MIME type - add auto-calculated `og:image:width` and `og:image:height` - you can now set the key `facebook_author = "xyz"` in the front matter of posts (also possible to set a fallback under `Site.Params.facebook_author`) to have the `article:author` meta tag set to `"https://www.facebook.com/xyz/"` - add `article:publisher` if `facebook_site` is set in `Site.Params` - use the post banner image for both `og:image` and `twitter:image` if present and fall back to `static/img/sharing-default.png` otherwise - make `twitter:card` only of type `summary_large_image` if page is a blog post and has a dedicated banner image set - add `twitter:creator` meta tag if the key `twitter_author` is present in the front matter of posts (also possible to set a fallback under `Site.Params.twitter_author`) - added some examples for facebook/twitter authors in the example `.md` posts - make `twitter:site` meta tag disappear if `twitter_site` is not set in `Site.Params` - truncate `twitter:title` and `twitter:description` to max allowed length (70 and 200 chars) - `markdownify` and `plainify` various strings for convenience - simplify code/improve style * use additional variables to avoid code redundancy * document how to set HTML metadata * clarify metadata documentation * also mention `og:updated_time` * clarify sentence about HTML metadata --- exampleSite/config.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'exampleSite/config.toml') diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 6e94f29..b3dfcb0 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -73,9 +73,10 @@ paginate = 10 defaultKeywords = ["devows", "hugo", "go"] defaultDescription = "Site template made by devcows using hugo" - # Twitter - twitter = "GoHugoIO" - twitterImage = "img/twitter-default.png" + # Social media + facebook_site = "" # the Facebook handle of your site ('https://www.facebook.com/HANDLE') + twitter_site = "GoHugoIO" # the Twitter handle of your site (without the '@') + default_sharing_image = "img/sharing-default.png" # Google Maps API key (if not set will default to not passing a key.) googleMapsApiKey = "AIzaSyCFhtWLJcE30xOAjcbSFi-0fnoVmQZPb1Y" -- cgit v1.2.3