Audit a Hugo site's SEO with PageAudit
Write the title, description and canonical link in the theme head, turn on robots.txt and audit the published page.
Updated
1Write the head
In the base layout head, use the page title and description, with the site description as the fallback. Each page's description comes from the description field in its front matter.
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ .Title }} | {{ site.Title }}{{ end }}</title>
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{ site.Params.description }}{{ end }}">
<link rel="canonical" href="{{ .Permalink }}">2Turn on robots.txt
In hugo.toml, enableRobotsTXT makes Hugo write /robots.txt. /sitemap.xml already comes out of every build, with the site baseURL.
baseURL = "https://example.com/"
enableRobotsTXT = true
[params]
description = "What this page offers, in one sentence."3Audit the published page
Change the address to the published page. The answer brings the score, the counts and each error with its fix. No key: 10 free audits a day.
curl -sS -X POST https://pageaudit.online/api/audit \
-H 'content-type: application/json' \
-d '{"url": "https://example.com/"}'