From 4bf7c1f25651b67e5f589131f1b87a9eeb297f04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Kula?=
<148193449+mkibp@users.noreply.github.com>
Date: Wed, 27 Mar 2024 09:25:37 +0100
Subject: [PATCH] Bug 35812: add noindex attribute to search result pages in
OPAC
This will prevent search engines from putting the search results pages into their indexes, to prevent cluttering of the search results and give better visibility to the actual bibliographic records' pages.
Note that "noindex" is separate from "nofollow", meaning that the search engine is allowed to get and process the search results page and extract ("follow") further links from it, such as links to biblio records, which is exactly what we want.
This approach is better to the sitemaps, which search engines are free to choose whether to use or not, based on multiple factors such as the size of the page. In practice for small pages Google will just not download them at all, meaning that indexing by following links around is the only way the indexer will extract any links.
Note that for this to work properly, you must NOT block the affected pages in your robots.txt file (they're not blocked by default).
Also, this patch moves "cssinclude" block in opac-results.tt inside of
, because in all other templates it's inside, meaning its current positioning is a small mistake I fixed while at it.
Signed-off-by: Pedro Amorim
Signed-off-by: Martin Renvoize
---
.../opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt | 1 +
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browse.tt | 1 +
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt
index ed9819ad20f..8dc1c2b9ef3 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-authorities-home.tt
@@ -5,6 +5,7 @@
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
Authority search › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog
+
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browse.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browse.tt
index d050b5941dd..6619137c4cf 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browse.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-browse.tt
@@ -6,6 +6,7 @@
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
[% INCLUDE 'doc-head-open.inc' %]
Browse our catalog › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog
+
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
[% INCLUDE 'bodytag.inc' bodyid='opac-browser' %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
index 38b4b97fe10..0df04992ee8 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
@@ -25,11 +25,12 @@
›
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog
+
[% INCLUDE 'doc-head-close.inc' %]
+[% BLOCK cssinclude %][% END %]
-[% BLOCK cssinclude %][% END %]
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
--
2.45.0