all repos — website @ b1d749290849dad602d2710ea9fd7833fca5e372

My website

Set canonical links
Alan Pearce alan@alanpearce.eu
Wed, 24 Apr 2024 18:36:39 +0200
commit

b1d749290849dad602d2710ea9fd7833fca5e372

parent

d1a3c7ba0d3aa1644d526d69b6c22f7d0b55028d

M cmd/build/template.gocmd/build/template.go
@@ -122,6 +122,7 @@ return nil, err 	}
 	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))
M templates/homepage.htmltemplates/homepage.html
@@ -11,6 +11,7 @@ type="application/atom+xml"       title=""
       href="/atom.xml"
     />
+    <link href="" rel="canonical" />
     <style></style>
   </head>
   <body>
M templates/list.htmltemplates/list.html
@@ -11,6 +11,7 @@ type="application/atom+xml"       title="Site Title"
       href="/atom.xml"
     />
+    <link href="" rel="canonical" />
     <style></style>
   </head>
   <body>
M templates/post.htmltemplates/post.html
@@ -11,6 +11,7 @@ type="application/atom+xml"       title=""
       href="/atom.xml"
     />
+    <link href="" rel="canonical" />
     <style></style>
   </head>
   <body>
M templates/tags.htmltemplates/tags.html
@@ -11,6 +11,7 @@ type="application/atom+xml"       title="Site title"
       href="/atom.xml"
     />
+    <link href="" rel="canonical" />
     <style></style>
   </head>
   <body>