Encode "+" characters in canonical URLs
authorThierry Florac <tflorac@ulthar.net>
Wed, 09 Jan 2019 10:22:32 +0100
changeset 356 c00a39cd7f01
parent 355 a9ecbf6ad7ed
child 357 91b2ec075f2b
Encode "+" characters in canonical URLs
src/pyams_default_theme/templates/layout.pt
src/pyams_default_theme/templates/preview-layout.pt
--- a/src/pyams_default_theme/templates/layout.pt	Wed Jan 09 10:18:36 2019 +0100
+++ b/src/pyams_default_theme/templates/layout.pt	Wed Jan 09 10:22:32 2019 +0100
@@ -33,7 +33,9 @@
 		</tal:var>
 	</tal:if>
 
-	<link rel="canonical" href="${tales:canonical_url(context)}" />
+	<link rel="canonical"
+		  tal:define="context_url tales:canonical_url(context)"
+		  href="${context_url.replace('+', '%2B')}" />
 
 	${tales:resources}
 
--- a/src/pyams_default_theme/templates/preview-layout.pt	Wed Jan 09 10:18:36 2019 +0100
+++ b/src/pyams_default_theme/templates/preview-layout.pt	Wed Jan 09 10:22:32 2019 +0100
@@ -12,7 +12,9 @@
 		<link rel="icon" tal:attributes="href url" type="image/x-icon">
 	</tal:if>
 
-	<link rel="canonical" tal:attributes="href tales:canonical_url(context)" />
+	<link rel="canonical"
+		  tal:define="context_url tales:canonical_url(context)"
+		  href="${context_url.replace('+', '%2B')}" />
 
 	<tal:var replace="tales:resources" />