ldeso/hugo-flex

patch to add metadata using Hugo internals

scivision opened this issue · 1 comments

This patch does two things:

  1. puts canonical link in the header. this is useful for sites that do redirects so that they don't get penalized by search engines for duplicated content.
  2. adds auto-generated metadata to header from Hugo internals: https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates
--- layouts/_default/baseof.html       2019-08-16 01:01:55.636909100 -0400
+++ layouts/_default/baseof.html        2019-08-16 01:31:07.890929500 -0400
@@ -6,6 +6,12 @@
 <head>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  <link rel="canonical" href="{{ .Site.BaseURL }}{{ .RelPermalink }}">
+
+  {{ template "_internal/schema.html" . }}
+  {{ template "_internal/opengraph.html" . }}
+  {{ template "_internal/twitter_cards.html" . }}
+
   <title>
     {{ if eq .Title site.Title }}
     {{ site.Title }}
ldeso commented

Thank you very much!