Search engines use the "<link rel=canonical>" convention to determine that, no
matter how many variations on a URL you might generate through the likes of
appending &query= parameters, etc, those URLs are all the same as the value of
the href attribute in the <link> element.
Start with a simple implementation that, first, provides a placeholder in the
TPAC base where any page-specific <meta> or <link> (or really, any other <head>
contents) should go; then denotes the current page URL (stripped of all query
params) as the canonical URL for record and library pages.
This should help prevent search engines from crawling endless variations of the
same page, lowering load on Evergreen servers and potentially improving the
ranking of the canonical URLs.
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Conflicts:
Open-ILS/src/templates/opac/parts/base.tt2
WRAPPER "opac/parts/base.tt2";
INCLUDE "opac/parts/topnav.tt2";
ctx.page_title = l("Library details: [_1]", ctx.library.name);
+ canon = ctx.proto _ '://' _ ctx.hostname _ mkurl('', {}, 1);
+ metalinks = '<link rel="canonical" href="' _ canon _ '" />';
-%]
[%- INCLUDE "opac/parts/searchbar.tt2" %]
[%- INCLUDE "opac/parts/library/core_info.tt2"; %]
<title>[% l('[_1] - [_2]', ctx.page_title, libname) %]</title>
<link rel="unapi-server" type="application/xml" title="unAPI" href="/opac/extras/unapi" />
<link type="application/opensearchdescription+xml" rel='search' title="[% l('[_1] OpenSearch', libname) %]" href="/opac/extras/opensearch/1.1/[% libsname | uri %]/-/osd.xml" />
+ [%-# Hook for page-specific metadata such as <meta name="robots" content="noindex"> %]
+ [% metalinks; -%]
[% IF want_dojo %]
<style type="text/css">
@import "[% ctx.media_prefix %]/js/dojo/dijit/themes/tundra/tundra.css";
WRAPPER "opac/parts/base.tt2";
INCLUDE "opac/parts/topnav.tt2";
ctx.page_title = l("Record Detail");
+ canon = ctx.proto _ '://' _ ctx.hostname _ mkurl('', {}, 1);
+ metalinks = '<link rel="canonical" href="' _ canon _ '" />';
IF CGI.param("expand"); basic_search = "f"; END;
-%]
<h2 class="sr-only">[% l('Record Details') %]</h2>