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

jimjag pushed a commit to branch cleaned-up
in repository https://gitbox.apache.org/repos/asf/openoffice-org.git

commit 9f8c543b556a0d56635e29af32ded7bb49ab0874
Author: Jim Jagielski <[email protected]>
AuthorDate: Wed Oct 14 16:37:07 2026 -0400

    Link breadcrumbs only to those directories that have an index page
---
 templates/breadcrumbs.gsp | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/templates/breadcrumbs.gsp b/templates/breadcrumbs.gsp
index 320b8a6396..a8db2954d7 100644
--- a/templates/breadcrumbs.gsp
+++ b/templates/breadcrumbs.gsp
@@ -3,6 +3,17 @@ String[] dirs = content.uri.split("/")
 // start the breadcrumbs
 def path = "/"
 def breadcrumbs = "<a href=\"${path}\">home</a>"
+// the site is baked in two halves (root and part2); a directory index can 
live in either
+def cwd = new File(".").getCanonicalFile()
+def roots = [cwd, new File(cwd, "part2")]
+if (cwd.getName() == "part2") roots << cwd.getParentFile()
+def hasIndex = { String dir ->
+   roots.any { r ->
+      ["content", "assets"].any { base ->
+         ["html", "htm", "md"].any { ext -> new File(r, base + dir + "index." 
+ ext).exists() }
+      }
+   }
+}
 // save each breadcrumb path for ssi analysis
 def ssi = new String[dirs.length]
 ssi[0] = path
@@ -12,7 +23,11 @@ if (n > 0) {
    for (int i=0; i < n; i++) {
        // breadcrumb and path for each directory
        path += dirs[i]+"/";
-       breadcrumbs += "&nbsp;&raquo;&nbsp;<a href=\"${path}\">${dirs[i]}</a>";
+       if (hasIndex(path)) {
+          breadcrumbs += "&nbsp;&raquo;&nbsp;<a 
href=\"${path}\">${dirs[i]}</a>";
+       } else {
+          breadcrumbs += "&nbsp;&raquo;&nbsp;${dirs[i]}";
+       }
        ssi[i+1] = path
    }
 }

Reply via email to