From df976621fb1e2163eae24f96f74d8809ebd66aaa Mon Sep 17 00:00:00 2001 From: Ben Shum Date: Mon, 16 Feb 2015 03:59:00 -0500 Subject: [PATCH] LP#1406451: 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 Signed-off-by: Ben Shum Conflicts: Open-ILS/src/templates/opac/parts/base.tt2 --- 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 4cd408ff5d..f971c5e553 100644 --- a/Open-ILS/src/templates/opac/parts/base.tt2 +++ b/Open-ILS/src/templates/opac/parts/base.tt2 @@ -17,6 +17,8 @@ [% l('[_1] - [_2]', ctx.page_title, libname) %] + [%-# Hook for page-specific metadata such as %] + [% metalinks; -%] [% IF want_dojo %]