From 020882f6ec3658a873f55d162ba114a7bd9288ae Mon Sep 17 00:00:00 2001 From: Dudi Levy <4785835+dudil@users.noreply.github.com> Date: Tue, 27 Feb 2018 16:39:14 +0200 Subject: [PATCH] - Add SEO elements to header, i18l friendly (#122) - Add Hugo related SEO parameters to example config.toml - Add relevant instructions to the README.md file --- README.md | 32 ++++++++++++++++++++++++++++++++ exampleSite/config.toml | 3 +++ layouts/partials/header.html | 1 + layouts/partials/seo_schema.html | 26 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+) create mode 100644 layouts/partials/seo_schema.html diff --git a/README.md b/README.md index 68ad0168..6aabc9ca 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ interested in seeing a live example. - [exampleSite](#examplesite) - [config.toml](#configtoml) - [Hugo's Built-In Server](#hugos-built-in-server) + - [Hugo's website SEO](#hugos-website-seo) - [Shortcodes](#shortcodes) - [fancybox](#fancybox) - [img-post](#img-post) @@ -115,6 +116,37 @@ hugo server You will then be able to view your live website at [localhost:1313](http://localhost:1313). +### Hugo's website SEO + +This theme support SEO elements for your website. +It was adapted and integrated thanks to the following guide: +[https://keithpblog.org/post/hugo-website-seo/](https://keithpblog.org/post/hugo-website-seo/) + +If you wish to enable SEO on this theme, follow these instructions: +1. To include the following parameters in your _config.toml_ +``` +# .config.toml +... +enableRobotsTXT = true +canonifyURLs = true +# and if you think your md file names or locations might change: +[permalinks] + post = "/blog/:title/" +... +``` + +2. Add your website to Google Search Console: + - Login to the [Google Search Console](https://www.google.com/webmasters/tools/home) + - Add your website as property + - Add the html page as required by google to verify ownership + - Submit the sitemap (/sitemap.xml) for indexing + - Wait + +3. Add your website to Bing + - Login to the [Bing Webmaster Console](https://www.bing.com/toolbox/webmaster/) + - Add your site, details and verify + - From the 3 option, we recommend adding the xml file to you website + ## Shortcodes In addition to the native [Hugo shortcodes](https://gohugo.io/extras/shortcodes/), the theme also includes the following codes that I hope you find useful: diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e171304b..3ff41842 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -7,6 +7,9 @@ paginate = 3 disqusShortname = "shortname" googleAnalytics = "" pluralizeListTitles = false +# Set the followings to true as part of your site SEO +enableRobotsTXT = true +canonifyURLs = true [params] # Sets the meta tag description diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 03d8096d..b954fe92 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -6,6 +6,7 @@ --> + {{ partial "seo_schema" . }} {{ with $.Scratch.Get "generalTitle" }} {{ . }} {{ else }} diff --git a/layouts/partials/seo_schema.html b/layouts/partials/seo_schema.html new file mode 100644 index 00000000..a30598d6 --- /dev/null +++ b/layouts/partials/seo_schema.html @@ -0,0 +1,26 @@ + \ No newline at end of file