From 283cd5f6639bedceeed2748674c6e6894eb4e402 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 31 Dec 2014 00:33:41 -0500 Subject: [PATCH] LP1406451 Set rel=canonical for record and library pages Search engines use the "" 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 element. Start with a simple implementation that, first, provides a placeholder in the TPAC base where any page-specific or (or really, any other 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 --- Open-ILS/src/templates/opac/library.tt2 | 2 ++ Open-ILS/src/templates/opac/parts/base.tt2 | 2 ++ Open-ILS/src/templates/opac/record.tt2 | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Open-ILS/src/templates/opac/library.tt2 b/Open-ILS/src/templates/opac/library.tt2 index f733ca0b0c..695566be72 100644 --- a/Open-ILS/src/templates/opac/library.tt2 +++ b/Open-ILS/src/templates/opac/library.tt2 @@ -2,6 +2,8 @@ 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 = ''; -%] [%- INCLUDE "opac/parts/searchbar.tt2" %] [%- INCLUDE "opac/parts/library/core_info.tt2"; %] diff --git a/Open-ILS/src/templates/opac/parts/base.tt2 b/Open-ILS/src/templates/opac/parts/base.tt2 index 03e950d439..13f45ea010 100644 --- a/Open-ILS/src/templates/opac/parts/base.tt2 +++ b/Open-ILS/src/templates/opac/parts/base.tt2 @@ -14,6 +14,8 @@ [% l('Catalog - [_1]', ctx.page_title) %] + [%-# Hook for page-specific metadata such as %] + [% metalinks; -%] [% IF want_dojo %]