Kanonische Links über _canonical realisiert frontend
authorKai Moritz <kai@juplo.de>
Mon, 7 Mar 2022 22:14:32 +0000 (23:14 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 7 Mar 2022 22:14:32 +0000 (23:14 +0100)
dist/sitemap.json
dist/templates/layout.html

index a1a4a2c..e97ceff 100644 (file)
       "/index.html",
       "/templates/error.html"
     ]
-  }
+  },
+  "_canonical": {}
 }
index 16da131..7175241 100644 (file)
@@ -5,17 +5,17 @@
     th:fragment="layout(uri,maincontent)"
     thymeproxy:variables="SET:sitemap.json"
     >
-  <head>
+  <head thymeproxy:variables="${json}">
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <title th:replace="${title}">juplo - BASISTEMPLATE</title>
     <link rel="stylesheet" href="../css/juplo.css" th:href="@{/css/juplo.css}">
-    <link rel="caononical" href="layout.html" th:replace="${scripts_head}?:~{}">
+    <link rel="canonical" href="layout.html" th:href="${_canonical.get(uri)}?:${uri}">
+    <script th:replace="${scripts_head}?:~{}"></script>
   </head>
   <body
       th:fragment="body(uri, maincontent, marginalcontent)"
-      thymeproxy:variables="${json}"
       th:with="crumbs=${_crumbs.get(uri)}">
     <div id="page" class="">
       <main class="content section" th:include="${maincontent}" th:fragment="maincontent">