Commit 488ab22a authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: add a prerender link

This allows crawlers like wget to also fetch the rendering gadget without executing any JS
parent 7cc426d7
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
dialog_category python: ''; dialog_category python: '';
web_site python: here.getWebSiteValue(); web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue(); web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='');
global_definitions_macros here/global_definitions/macros;"> global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" /> <tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<html> <html>
...@@ -28,8 +29,11 @@ ...@@ -28,8 +29,11 @@
<script src="portal_skins/erp5_xhtml_style/renderjs.js"></script> <script src="portal_skins/erp5_xhtml_style/renderjs.js"></script>
<script src="gadget_global.js"></script> <script src="gadget_global.js"></script>
<script src="jsstyle.js"></script> <script src="jsstyle.js"></script>
<tal:block tal:condition="python: no_style_gadget_url != ''">
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</head> </head>
<body tal:attributes="data-nostyle-gadget-url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='')"> <body tal:attributes="data-nostyle-gadget-url no_style_gadget_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block> <tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<main> <main>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
dummy python: request.set('editable_mode', False); dummy python: request.set('editable_mode', False);
web_site python: here.getWebSiteValue(); web_site python: here.getWebSiteValue();
web_section python: here.getWebSectionValue(); web_section python: here.getWebSectionValue();
no_style_gadget_url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='');
global_definitions_macros here/global_definitions/macros;"> global_definitions_macros here/global_definitions/macros;">
<tal:block metal:use-macro="global_definitions_macros/header_definitions" /> <tal:block metal:use-macro="global_definitions_macros/header_definitions" />
<html> <html>
...@@ -27,8 +28,11 @@ ...@@ -27,8 +28,11 @@
<script src="portal_skins/erp5_xhtml_style/renderjs.js"></script> <script src="portal_skins/erp5_xhtml_style/renderjs.js"></script>
<script src="gadget_global.js"></script> <script src="gadget_global.js"></script>
<script src="jsstyle.js"></script> <script src="jsstyle.js"></script>
<tal:block tal:condition="python: no_style_gadget_url != ''">
<link rel="prerender" tal:attributes="href no_style_gadget_url">
</tal:block>
</head> </head>
<body tal:attributes="data-nostyle-gadget-url python: web_site.getLayoutProperty('configuration_style_gadget_url', default='')"> <body tal:attributes="data-nostyle-gadget-url no_style_gadget_url">
<tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block> <tal:block tal:content="structure python: web_site.WebSite_generateNavigationHTML()"></tal:block>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/> <p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertElementPresent</td>
<td>//head/link[@rel='prerender' and @href='jsstyle_demo.html']</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td> <td>//header/h1[text()='JS Style Demo']</td>
......
...@@ -31,6 +31,13 @@ ...@@ -31,6 +31,13 @@
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td> <td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertElementNotPresent</td>
<td>//head/link[@rel='prerender']</td>
<td></td>
</tr>
<tr> <tr>
<td>assertElementPresent</td> <td>assertElementPresent</td>
<td>//nav[@id='sitemap']/a[text()='No Style']</td> <td>//nav[@id='sitemap']/a[text()='No Style']</td>
......
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td> <td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertElementPresent</td>
<td>//head/link[@rel='prerender' and @href='jsstyle_demo.html']</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//header/h1[text()='JS Style Demo']</td> <td>//header/h1[text()='JS Style Demo']</td>
......
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
<td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td> <td>${base_url}/web_site_module/erp5_web_js_style_test_site/</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>assertElementNotPresent</td>
<td>//head/link[@rel='prerender']</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForTextPresent</td> <td>waitForTextPresent</td>
<td>No Style Form</td> <td>No Style Form</td>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment