]> git.plutz.net Git - shellwiki/commitdiff
filter foreign languages and system pages from search results
authorPaul Hänsch <paul@plutz.net>
Fri, 22 Sep 2023 15:26:37 +0000 (17:26 +0200)
committerPaul Hänsch <paul@plutz.net>
Fri, 22 Sep 2023 15:26:37 +0000 (17:26 +0200)
handlers/40_search.sh

index f057e45fee3a15cbfa6cb4120b03fccfc6d651b8..823ef76520a39db2dbe200d77b304fe977fdeaf6 100644 (file)
@@ -36,6 +36,11 @@ done \
 | sort -nr \
 | while read freq doc; do
   page="$(UNSTRING "$doc")"
+  [ "${page%*/\[*\]/*}" != "$page" ] && continue
+  if [ "$LANGUAGE_DEFAULT" ]; then
+    [ -d "${_DATA}/pages/${page}/:${LANGUAGE}/" ] && continue
+    [ "${page%/:*/}" = "${page%/:${LANGUAGE}/}" ] || continue
+  fi
   acl_read "$page" || continue
   printf '<li><a href="%s">%s</a></li>' "$(URL "$page")" "$(HTML "$page")"
 done \