Hugo website SEO

August 9, 2017


You want to be found on the web. Search Engines want to help…

Hugo or your Hugo theme might provide some SEO components out of the box, but consider adding what it doesn’t, then tell google; bing and other search engines about your site.

Part 1: Add SEO elements to your website

See also about SEO elements -> https://developers.google.com/search/docs/guides

1. Configuration:

By default Hugo or your Hugo theme will give you:

  1. A sitemap at /sitemap.xml: useful to submit to search engines like google ( see below ).
  2. RSS feed.

Update your config.toml file to ensure you have a configuration similar to this:

# .config.toml
...
enableRobotsTXT = true
canonifyURLs = true
# and if you think your md file names or locations might change:
[permalinks]
    post = "/blog/:title/"
...

2. Add a Schema.org partial:

See also about structured data snippets -> https://developers.google.com/search/docs/guides/intro-structured-data

Add a modified ‘header’ partial to reference a ‘seo’ partial. This will override the header partial in your theme, so start with a copy of that file and add:

# layouts/partials/header.html
...
{{ partial "seo_schema" . }}
<title>
...

Add a ‘seo_schema’ partial

// layouts/partials/seo_schema.html

<script type="application/ld+json">
{
    "@context" : "http://schema.org",
    "@type" : "BlogPosting",
    "mainEntityOfPage": {
         "@type": "WebPage",
         "@id": "{{ .Site.BaseURL }}"
    },
    "articleSection" : "{{ .Section }}",
    "name" : "{{ .Title }}",
    "headline" : "{{ .Title }}",
    "description" : "{{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }}",
    "inLanguage" : "en-US",
    "author" : "{{ range .Site.Author }}{{ . }}{{ end }}",
    "creator" : "{{ range .Site.Author }}{{ . }}{{ end }}",
    "publisher": "{{ range .Site.Author }}{{ . }}{{ end }}",
    "accountablePerson" : "{{ range .Site.Author }}{{ . }}{{ end }}",
    "copyrightHolder" : "{{ range .Site.Author }}{{ . }}{{ end }}",
    "copyrightYear" : "{{ .Date.Format "2006" }}",
    "datePublished": "{{ .Date }}",
    "dateModified" : "{{ .Date }}",
    "url" : "{{ .Permalink }}",
    "wordCount" : "{{ .WordCount }}",
    "keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{ end }}"Blog" ]
}
</script>

Git commit and push.

Part 2: Google Search Console

Track your site’s search performance with Google Search Console and browse around for more webmaster resources : https://www.google.com/webmasters/tools/home

In Google’s Webmasters Console:

  1. Add a property (your website)
  2. Add the html page as required by google to verify ownership
  3. Submit the sitemap (/sitemap.xml) for indexing
  4. Wait.

Return to the Google Search Console after several days to see if your site has been indexed. A queued request typically takes several days for a successful request to be granted. Google doesnt guarantee that it will index all your changes, as it relies on “a complex algorithm to update indexed materials”.

Part 3: Bing webmaster tools

The Bing Webmasters Console is here: https://www.bing.com/toolbox/webmaster/

In Bing’s Webmasters Console, Add your site, details and verify.

Bing offers 3 ways to verify ownership:

  1. Add an xml file;
  2. Add a metatag;
  3. Add a CNAME record in your DNS.

Now wait for Bing to complete the indexing.

Part 4: Yandex webmaster tools

This is for DuckDuckGo.

Yandex and Bing both contribute to DuckDuckGo’s indexing ( Yandex has a partnership with DuckDuckGo according to https://blog.r3bl.me/en/exploring-duckduckgo-for-smaller-websites/ )

The Yandex Webmasters Console is here: https://webmaster.yandex.com

Click the + button at the top of the screen and enter your site address

Yandex offers 4 ways to verify ownership:

  1. Add an HTML file;
  2. Add a metatag;
  3. Add a TXT record in your DNS.
  4. Use the WHOIS email

After verification, add the sitemap file /sitemap.xml.

Now wait a couple of weeks.

© 2018 Keith P | Follow on Twitter | Git