Hugo website SEO

Hugo website SEO

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.

1. Add SEO elements to your website


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

Configuration


By default Hugo or your Hugo theme will give you:

  • A sitemap at /sitemap.xml: useful to submit to search engines like google ( see below ).

  • RSS feed.

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

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

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
# layouts/partials/header.html
...
{{ partial "seo_schema" . }}
<title>
...

Add a seo_schema partial

layouts/partials/seo_schema.html
// 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>

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:

  • Add a property (your website)

  • Add the html page as required by google to verify ownership

  • Submit the sitemap (/sitemap.xml) for indexing

  • 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.

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:

  • Add an xml file;

  • Add a metatag;

  • Add a CNAME record in your DNS.

Now wait for Bing to complete the indexing.

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:

  • Add an HTML file;

  • Add a metatag;

  • Add a TXT record in your DNS.

  • Use the WHOIS email

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

Now wait a couple of weeks.

SUBSCRIBE FOR NEW ARTICLES

@
comments powered by Disqus