Set up page's seo with hugo

Seo is nothing without good and caveat content. But find this content is very difficult without seo. In previous articles we created a simple blog based on hugo. In this article I will tell how to set up page’s seo on your site.

Minimal check-list

  1. Language of your page should be equals with language in meta tag:
<html lang="en-us">
  1. Page url should be equals with page’s H1 header:
header: Set up docker and portainer
  1. Page’s title should length of 55-65 characters. It will be good, if your title be like: | .
  2. Page should have a meta tag ‘description’ with leggth of 155–160 characters.

Of course, your content should be unique, useful and etc.

Search bot helpers

There are several standards which should help to a search bot when indexing our sites.

You can read sites by links for more details about standards.

Hugo has internal modules for each of it.

{{ template "_internal/schema.html" . }}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}

To enable, you should include its to end of your head.html partial. You should consider to opengraph.html uses parameter images. If your theme based in parameter image in posts, you need to place parameter images too:

image = "img/seo/seo.jpeg"
images = ["img/seo/seo.jpeg"]

But you can update your theme or opengraph.html partial =)

If you want to use json configuration of instead of meta tags, you can use next partial:

<script type="application/ld+json">
        "@context" : "",
        "@type" : "TechArticle",
        "mainEntityOfPage": {
             "@type": "WebPage",
             "@id": {{ .Site.BaseURL }}
        "articleSection" : "{{if .Section}}{{ .Section }}{{else}}main{{end}}",
        "name" : {{ .Title }},
        "headline" : {{ .Title }},
        "description" : {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{else}}{{.Site.Params.description}}{{ end }}{{ end }},
        "inLanguage" : "en",
        "author" : "{{if}}{{ }}{{else}}{{}}{{end}}",
        "creator" : "{{if}}{{ }}{{else}}{{}}{{end}}",
            "@type": "Organization",
            "name": "{{if}}{{ }}{{else}}{{}}{{end}}",
            "logo": {
                "@type": "ImageObject",
                "url": {{ .Site.Params.image }}
        "accountablePerson" : "{{if}}{{ }}{{else}}{{}}{{end}}",
        "copyrightHolder" : "{{if}}{{ }}{{else}}{{}}{{end}}",
        "copyrightYear" : "{{ .Date.Format "2006" }}",
        "datePublished": {{ .Date }},
        "dateModified" : {{ .Date }},
        "url" : {{ .Permalink }},
        "wordCount" : "{{ .WordCount }}",
        "image" : {{ if .Page.Params.Image }}{{.Page.Params.Image}}{{else}}{{ .Site.Params.image }}{{ end }},
        "keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}"{{ . }}",{{ end }}{{else}}{{ range .Site.Params.keywords }}"{{ . }}",{{ end }}{{ end }}"Blog" ]

Theme of seo is very extensive. But your site will be well indexed after previous configs. Also you should check your seo-ranks in many online checkers from internet. It is very helpful!

Previous post » Set up hugo and gitlab ci