From b1d749290849dad602d2710ea9fd7833fca5e372 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 24 Apr 2024 18:36:39 +0200 Subject: Set canonical links --- cmd/build/template.go | 1 + templates/homepage.html | 1 + templates/list.html | 1 + templates/post.html | 1 + templates/tags.html | 1 + 5 files changed, 5 insertions(+) diff --git a/cmd/build/template.go b/cmd/build/template.go index 32f408f..4f7552c 100644 --- a/cmd/build/template.go +++ b/cmd/build/template.go @@ -122,6 +122,7 @@ func layout(filename string, config config.Config, pageTitle string, pageURL str } doc.Find("html").SetAttr("lang", config.DefaultLanguage) doc.Find("head > link[rel=alternate]").SetAttr("title", config.Title) + doc.Find("head > link[rel=canonical]").SetAttr("href", pageURL) doc.Find(".title").SetText(config.Title) doc.Find("title").Add(".p-name").SetText(pageTitle) doc.Find("head > style").SetHtml("\n" + string(css)) diff --git a/templates/homepage.html b/templates/homepage.html index 63d3fbf..164607d 100644 --- a/templates/homepage.html +++ b/templates/homepage.html @@ -11,6 +11,7 @@ title="" href="/atom.xml" /> +
diff --git a/templates/list.html b/templates/list.html index 086e139..b958239 100644 --- a/templates/list.html +++ b/templates/list.html @@ -11,6 +11,7 @@ title="Site Title" href="/atom.xml" /> + diff --git a/templates/post.html b/templates/post.html index d93b766..d749104 100644 --- a/templates/post.html +++ b/templates/post.html @@ -11,6 +11,7 @@ title="" href="/atom.xml" /> + diff --git a/templates/tags.html b/templates/tags.html index 406f8d7..f05a651 100644 --- a/templates/tags.html +++ b/templates/tags.html @@ -11,6 +11,7 @@ title="Site title" href="/atom.xml" /> + -- cgit 1.4.1