Updated layout template
authorThierry Florac <tflorac@ulthar.net>
Wed, 16 Jan 2019 18:55:19 +0100
changeset 378 72293e510f03
parent 377 a85e1863d73d
child 379 240417d006df
Updated layout template
src/pyams_default_theme/templates/layout.pt
--- a/src/pyams_default_theme/templates/layout.pt	Mon Jan 14 17:44:24 2019 +0100
+++ b/src/pyams_default_theme/templates/layout.pt	Wed Jan 16 18:55:19 2019 +0100
@@ -1,48 +1,35 @@
 <!DOCTYPE html>
 <html lang="en" i18n:domain="pyams_default_theme"
 	  tal:define="config tales:configuration;"
-	  tal:attributes="lang request.locale_name">
+	  lang="${request.locale_name}">
 <head prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#">
 	${structure:tales:metas}
 
 	<tal:if define="icon config.icon | nothing;
 					url tales:absolute_url(icon);"
-			condition="icon">
-		<!-- Favorite icon -->
-		<tal:var define="size icon.get_image_size()[0];
-						 timestamp tales:timestamp(icon)">
-			<link tal:condition="size > 144"
-				  rel="apple-touch-icon" sizes="180x180" href="${url}/++thumb++180x180?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 114"
-				  rel="apple-touch-icon" sizes="144x144" href="${url}/++thumb++144x144?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 72"
-				  rel="apple-touch-icon" sizes="114x114" href="${url}/++thumb++114x114?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 32"
-				  rel="apple-touch-icon" sizes="72x72" href="${url}/++thumb++72x72?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 16"
-				  rel="apple-touch-icon" sizes="32x32" href="${url}/++thumb++32x32?_=${timestamp}" type="${icon.content_type}" />
+			condition="icon"><!-- Favorite icon --><tal:var
+		define="size icon.get_image_size()[0];
+				timestamp tales:timestamp(icon)"><tal:loop
+			repeat="icon_size (180, 144, 114, 72, 32)"><link
+				tal:condition="size >= icon_size" type="${icon.content_type}"
+				rel="apple-touch-icon" sizes="${icon_size}x${icon_size}"
+				href="${url}/++thumb++${icon_size}x${icon_size}?_=${timestamp}" /></tal:loop>
 			<link rel="apple-touch-icon" sizes="16x16" href="${url}/++thumb++16x16?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 64"
-				  rel="icon" sizes="128x128" href="${url}/++thumb++128x128?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 32"
-				  rel="icon" sizes="64x64" href="${url}/++thumb++64x64?_=${timestamp}" type="${icon.content_type}" />
-			<link tal:condition="size > 16"
-				  rel="icon" sizes="32x32" href="${url}/++thumb++32x32?_=${timestamp}" type="${icon.content_type}" />
+			<tal:loop repeat="icon_size (128, 64, 32)"><link
+				tal:condition="size >= icon_size" type="${icon.content_type}"
+				rel="icon" sizes="${icon_size}x${icon_size}"
+				href="${url}/++thumb++${icon_size}x${icon_size}?_=${timestamp}" /></tal:loop>
 			<link rel="icon" sizes="16x16" href="${url}/++thumb++16x16?_=${timestamp}" type="${icon.content_type}" />
 			<link rel="shortcut icon" href="${url}" type="${icon.content_type}" />
-		</tal:var>
-	</tal:if>
-
+		</tal:var></tal:if>
 	<link rel="canonical"
 		  tal:define="context_url tales:canonical_url(context)"
 		  href="${context_url.replace('+', '%2B')}" />
 
-	${tales:resources}
-
 	<!-- Javascript extensions -->
 	${structure:provider:pyams.jsextensions}
 	<!-- end javascript extensions -->
-
+	${tales:resources}
 </head>
 <body class="no-margin no-padding">