You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2026/05/01 19:05:17 UTC

(grails-static-website) branch fix-guide-renderer-theme updated: Address Copilot review on guide-renderer template (refs #354)

This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch fix-guide-renderer-theme
in repository https://gitbox.apache.org/repos/asf/grails-static-website.git


The following commit(s) were added to refs/heads/fix-guide-renderer-theme by this push:
     new e1b23f11e5d Address Copilot review on guide-renderer template (refs #354)
e1b23f11e5d is described below

commit e1b23f11e5dcf6b95a0bb6ec65a86a80c04e71de
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Fri May 1 15:05:12 2026 -0400

    Address Copilot review on guide-renderer template (refs #354)
    
    HTML-escape the section title to prevent injection from titles containing
    &, <, etc. Replace the legacy GA + AdRoll trackers in layout.html with the
    Matomo configuration the rest of grails.apache.org uses (analytics.apache.org
    site ID 79). Update the RenderGuidesPlugin Javadoc to reflect that templates
    now live in guides/resources/ rather than the previous buildSrc path.
    
    Assisted-by: claude-code:claude-4.6-opus
---
 .../website/gradle/RenderGuidesPlugin.groovy       |  8 +++-
 guides/resources/style/layout.html                 | 46 ++++++++--------------
 guides/resources/style/section.html                |  2 +-
 3 files changed, 23 insertions(+), 33 deletions(-)

diff --git a/buildSrc/src/main/groovy/website/gradle/RenderGuidesPlugin.groovy b/buildSrc/src/main/groovy/website/gradle/RenderGuidesPlugin.groovy
index 64cb4dc586e..49cfaa2a35a 100644
--- a/buildSrc/src/main/groovy/website/gradle/RenderGuidesPlugin.groovy
+++ b/buildSrc/src/main/groovy/website/gradle/RenderGuidesPlugin.groovy
@@ -64,8 +64,12 @@ import website.gradle.tasks.VendorGuideTask
  *
  * <p>The renderer itself is the vendored {@code grails.doc.*} subtree (see
  * {@code buildSrc/VENDOR.md}). Templates and theme assets live in
- * {@code buildSrc/src/main/template/} and are passed to
- * {@link PublishGuideTask#getResourcesDir()} as a filesystem path.</p>
+ * {@code guides/resources/} and are passed to
+ * {@link PublishGuideTask#getResourcesDir()} as a filesystem path. The
+ * {@code guides/resources/style/layout.html} template renders the legacy
+ * single-page guide chrome; {@code guideItem.html}, {@code section.html},
+ * {@code index.html}, {@code menu.html}, and {@code referenceItem.html}
+ * round out the bundle DocPublisher expects.</p>
  */
 @CompileStatic
 class RenderGuidesPlugin {
diff --git a/guides/resources/style/layout.html b/guides/resources/style/layout.html
index bcba5292ad9..d6671a99115 100644
--- a/guides/resources/style/layout.html
+++ b/guides/resources/style/layout.html
@@ -151,35 +151,21 @@
 </ul></nav>
   </div>
 </footer><div>
-  <script type='text/javascript'>
-              (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
-              (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
-              m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
-              })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
-
-              ga('create', 'UA-82213539-2', 'auto');
-              ga('send', 'pageview');
-</script>
-  <script type='text/javascript'>
-adroll_adv_id = "HBWJH4CQCJGS5DJRSB4Z4D";
-adroll_pix_id = "IVEQYFOZXZAPZMDVQH7BFE";
-/* OPTIONAL: provide email to improve user identification */
-/* adroll_email = "username@example.com"; */
-(function () {
-    var _onload = function(){
-        if (document.readyState && !/loaded|complete/.test(document.readyState)){setTimeout(_onload, 10);return}
-        if (!window.__adroll_loaded){__adroll_loaded=true;setTimeout(_onload, 50);return}
-        var scr = document.createElement("script");
-        var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com");
-        scr.setAttribute('async', 'true');
-        scr.type = "text/javascript";
-        scr.src = host + "/j/roundtrip.js";
-        ((document.getElementsByTagName('head') || [null])[0] ||
-            document.getElementsByTagName('script')[0].parentNode).appendChild(scr);
-    };
-    if (window.addEventListener) {window.addEventListener('load', _onload, false);}
-    else {window.attachEvent('onload', _onload)}
-}());            
-</script>
+  <!-- Matomo -->
+  <script>
+    var _paq = window._paq = window._paq || [];
+    _paq.push(['setDoNotTrack', true]);
+    _paq.push(['disableCookies']);
+    _paq.push(['trackPageView']);
+    _paq.push(['enableLinkTracking']);
+    (function() {
+      var u = 'https://analytics.apache.org/';
+      _paq.push(['setTrackerUrl', u + 'matomo.php']);
+      _paq.push(['setSiteId', '79']);
+      var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
+      g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
+    })();
+  </script>
+  <!-- End Matomo Code -->
 </div></body>
 </html>
diff --git a/guides/resources/style/section.html b/guides/resources/style/section.html
index 5dd9aed865d..dd0a3b39b3e 100644
--- a/guides/resources/style/section.html
+++ b/guides/resources/style/section.html
@@ -1,6 +1,6 @@
 <% def hLevel = level == 0 ? 1 : 2 %>
 <% if (legacyLinks[name]) { %><a name="${legacyLinks[name].encodeAsHtml()}"><!-- Legacy link --></a><% } %>
-<h$hLevel id="${name.encodeAsHtml()}">${sectionNumber} ${title}</h$hLevel>
+<h$hLevel id="${name.encodeAsHtml()}">${sectionNumber} ${title.encodeAsHtml()}</h$hLevel>
 <% if(sourceRepo) { %>
 <div class='contribute-btn'>
     <button type='button' class='btn btn-default' onclick='window.location.href="${sourceRepo}/guide/${sourcePath}"'>