LP#1507845: Improve search engine optimization
authorDan Scott <dscott@laurentian.ca>
Tue, 20 Oct 2015 02:21:58 +0000 (22:21 -0400)
committerBen Shum <ben@evergreener.net>
Wed, 2 Mar 2016 06:11:47 +0000 (01:11 -0500)
Back in bug # 1414033 , we added rel="nofollow" attributes to many of the links
that led to search results or call number browsing. This was the right idea,
but a bit overzealous as it turns out. We actually want search engines to
follow those links; we just don't want search engines to index them.

Therefore, we can tweak the <meta> tag in the results and browse page headers
to say "follow,noindex", and remove many of the inline rel="nofollow"
attributes from the other pages.

In addition, add a rel="canonical" link to the catalogue home page.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <ben@evergreener.net>
Conflicts:
Open-ILS/src/templates/opac/parts/record/subjects.tt2

14 files changed:
Open-ILS/src/templates/opac/advanced.tt2
Open-ILS/src/templates/opac/browse.tt2
Open-ILS/src/templates/opac/cnbrowse.tt2
Open-ILS/src/templates/opac/home.tt2
Open-ILS/src/templates/opac/mylist.tt2
Open-ILS/src/templates/opac/parts/advanced/search.tt2
Open-ILS/src/templates/opac/parts/record/authors.tt2
Open-ILS/src/templates/opac/parts/record/cnbrowse.tt2
Open-ILS/src/templates/opac/parts/record/navigation.tt2
Open-ILS/src/templates/opac/parts/record/series.tt2
Open-ILS/src/templates/opac/parts/record/subjects.tt2
Open-ILS/src/templates/opac/parts/result/paginate.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/src/templates/opac/results.tt2

index 8efb9f2..de86006 100644 (file)
@@ -5,7 +5,7 @@
     pane = CGI.param("pane") || "advanced";
     loc = ctx.search_ou;
 
-    ctx.metalinks.push('<meta name="robots" content="noindex">');
+    ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
 -%]
     <h2 class="sr-only">[% l('Advanced Search') %]</h2>
     <div id="search-wrapper">
index 0626f42..9d58cd0 100644 (file)
@@ -10,7 +10,7 @@
     blimit = CGI.param('blimit') || ctx.opac_hits_per_page || 10;
 
     depart_list = ['blimit', 'bterm', 'bpivot'];
-    ctx.metalinks.push('<meta name="robots" content="noindex">');
+    ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
 %]
 
     <h2 class="sr-only">[% l('Catalog Browse') %]</h2>
@@ -18,9 +18,9 @@
         [%# XXX TODO Give searchbar.tt2 more smarts so we can just do:
           # INCLUDE "opac/parts/searchbar.tt2" %]
         <div id="search-box">
-            <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]" rel="nofollow" vocab="">[% l('Basic Search') %]</a></span>
+            <span class="search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/home', {}, depart_list) %]">[% l('Basic Search') %]</a></span>
             <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {}, depart_list) %]"
-                    id="home_adv_search_link" rel="nofollow" vocab="">[%l('Advanced Search')%]</a></span>
+                    id="home_adv_search_link">[%l('Advanced Search')%]</a></span>
         
             <span class="browse_the_catalog_lbl mobile_hide">[% l('Browse the Catalog') %]</span>
         </div>
                 [% BLOCK browse_pager %]
                 <div class="browse-pager">
                     [% IF ctx.back_pivot %]
-                    <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';" rel="nofollow" vocab="">&larr; [%l ('Back') %]</a>
+                    <a class="opac-button" href="[% mkurl('', {bpivot => ctx.back_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">&larr; [%l ('Back') %]</a>
                     [% END %]
                     [% IF ctx.pager_shortcuts;
                         current_qtype = CGI.param('qtype') || 'title' %]
                     <span class="browse-shortcuts">
                         [% FOR shortcut IN ctx.pager_shortcuts %]
-                            <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]" rel="nofollow" vocab="">[% shortcut.1 %]</a>
+                            <a href="[% mkurl('', {qtype => current_qtype, bterm => shortcut.0}, ['bpivot','query']) %]">[% shortcut.1 %]</a>
                         [% END %]
                     </span>
                     [% END %]
 
                     [% IF ctx.forward_pivot %]
-                    <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';" rel="nofollow" vocab="">[%l ('Next') %] &rarr;</a>
+                    <a class="opac-button" href="[% mkurl('', {bpivot => ctx.forward_pivot}) %]" onclick="$('browse-pager-spinner-[% id %]').className = '';">[%l ('Next') %] &rarr;</a>
                     [% END %]
 
                     <img id="browse-pager-spinner-[% id %]" 
@@ -92,7 +92,7 @@
                             [% IF ctx.browse_leading_article_alternative %]
                             <p>
                             [% alternative_link = BLOCK %]
-                            <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]" rel="nofollow" vocab="">[% ctx.browse_leading_article_alternative | html %]</a>
+                            <a href="[% mkurl('', {bterm => ctx.browse_leading_article_alternative}, ['bpivot']) %]">[% ctx.browse_leading_article_alternative | html %]</a>
                             [%-  END; # alternative_link BLOCK
                                 l("Did you mean [_1]?", alternative_link);
                             END # IF %]
                                     <a href="[% mkurl(
                                         ctx.opac_root _ '/results', {
                                             'fi:has_browse_entry' => (result.browse_entry _ ',' _ result.fields)
-                                        }) %]" rel="nofollow" vocab="">[% result.value | html %]</a>
+                                        }) %]">[% result.value | html %]</a>
                                     <span class="browse-result-sources">([%
                                         IF result.accurate == 'f';
                                             l("At least"); " ";
                                                 [% END %]
 
                                                 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
-                                                <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]" rel="nofollow" vocab="">[% h.heading | html %]</a>
+                                                <a href="[% mkurl(ctx.opac_root _ '/browse', {bterm => h.heading}, ['bpivot']) %]">[% h.heading | html %]</a>
                                                 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
                                                 </li>
                                             [% END %]
                                                 <ul class="browse-result-authority-headings"> 
                                                 [% END %]
                                                 <li><span class="browse-result-authority-field-name">[% field.name %]</span>
-                                                <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]" rel="nofollow" vocab="">[% h.heading | html %]</a>
+                                                <a href="[% mkurl(ctx.opac_root _ '/results', {query => 'identifier|authority_id[' _ h.target _ ']'}) %]">[% h.heading | html %]</a>
                                                 <span class="browse-result-authority-bib-links">([% h.target_count %])</span>
                                                 </li>
                                             [% END %]
index a0908f6..3baa8c3 100644 (file)
@@ -3,7 +3,7 @@
 
     PROCESS "opac/parts/header.tt2";
     PROCESS "opac/parts/misc_util.tt2";
-    ctx.metalinks.push('<meta name="robots" content="noindex">');
+    ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
     WRAPPER "opac/parts/base.tt2";
     INCLUDE "opac/parts/topnav.tt2";
     ctx.page_title = l("Call Number Browse"); %]
index 3257ba4..77b1d51 100644 (file)
@@ -2,6 +2,7 @@
     WRAPPER "opac/parts/base.tt2";
     INCLUDE "opac/parts/topnav.tt2";
     ctx.page_title = l("Home") %]
+    ctx.metalinks.push('<link rel="canonical" href="' _ mkurl('', {}, 1) _ '" />');
     <h2 class="sr-only">[% l('Catalog Home') %]</h2>
     [% INCLUDE "opac/parts/searchbar.tt2" %]
     <div id="content-wrapper">
index 16488e2..5057800 100644 (file)
@@ -2,7 +2,7 @@
     PROCESS "opac/parts/misc_util.tt2";
     WRAPPER "opac/parts/base.tt2";
     INCLUDE "opac/parts/topnav.tt2";
-    ctx.metalinks.push('<meta name="robots" content="noindex">');
+    ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
     ctx.page_title = l("Record Detail") %]
     <h2 class="sr-only">[% l('Temporary List') %]</h2>
     <div class="mobile_hide">
index 79ae4c4..ea0e25b 100644 (file)
@@ -40,7 +40,7 @@
         </span>
 
         <a href="[% mkurl(ctx.opac_root _ '/advanced', {$loc_name => loc_value}, 1) %]"
-            class="opac-button" rel="nofollow" vocab="">[% l('Clear Form') %]</a>
+            class="opac-button">[% l('Clear Form') %]</a>
     </div>
 
     <div id='adv_search_filters'>
index fa8471a..735b3ef 100644 (file)
@@ -114,7 +114,7 @@ BLOCK build_author_links;
             END;
             iprop = iprop _ '"';
         END;
-        authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '" rel="nofollow" vocab=""><span resource="' _ contrib_ref _ '">';
+        authtml = ' <span class="rdetail-author-div"' _ iprop _ ' resource="' _ contrib_ref _ '"><a href="' _ url _ '"><span resource="' _ contrib_ref _ '">';
         IF iprop; authtml = authtml _ '<span property="name">'; END;
         authtml = authtml _ link_term.replace('^\s+', '');
         IF iprop; authtml = authtml _ '</span>'; END;
index 2dba5e5..835eab3 100644 (file)
                 <tr>
                     <td>
                         <a class='classic_link lbl1' 
-                            href="[% mkurl('', {cnoffset => cnoffset - 1}) %]#cnbrowse" rel="nofollow" vocab="">[% l("&lt;&lt; Previous Page") %]</a>
+                            href="[% mkurl('', {cnoffset => cnoffset - 1}) %]#cnbrowse">[% l("&lt;&lt; Previous Page") %]</a>
                     </td>
                     <td colspan='1' align='center'>[% l("Shelf Browser") %]</td>
                     <td>
                         <a class='classic_link lbl1' 
-                            href="[% mkurl('', {cnoffset => cnoffset + 1}) %]#cnbrowse" rel="nofollow" vocab="">[% l("Next Page &gt;&gt;") %]</a>
+                            href="[% mkurl('', {cnoffset => cnoffset + 1}) %]#cnbrowse">[% l("Next Page &gt;&gt;") %]</a>
                     </td>
                 </tr>
             <tr class='browse_border'>
@@ -47,7 +47,7 @@
                                 href="[%-
                                     authorquery = rec_attrs.author | replace('[,\.:;]', '');
                                     mkurl(ctx.opac_root _ '/results', {qtype => 'author', query => authorquery, $loc_name => loc_value}, 1)
-                                    -%]" rel="nofollow" vocab="">[% rec_attrs.author | html %]</a>
+                                    -%]">[% rec_attrs.author | html %]</a>
                         </div>[% END %]
                         <div class='cn_browse_info' name='cn_browse_lib'>[% cn.owning_lib.name | html %]</div>
                     </td>
index b93d6f4..003f6bd 100644 (file)
@@ -1,7 +1,7 @@
 [% IF ctx.search_result_index.defined && ctx.search_result_index >= 0 %]
 <div class="rdetail_header">
     <span class="rdetail_results">
-        <a href='[% mkurl(ctx.opac_root _ '/results', {}, stop_parms); %]' rel="nofollow" vocab=""><span class="nav_arrow_fix">&#9668;</span> [% l('Search Results') %]</a>
+        <a href='[% mkurl(ctx.opac_root _ '/results', {}, stop_parms); %]'><span class="nav_arrow_fix">&#9668;</span> [% l('Search Results') %]</a>
         <span class="rdetail_result_count">
             [% l('Showing Item [_1] of [_2]', ctx.search_result_index + 1, ctx.hit_count) %]
         </span>
@@ -18,7 +18,7 @@
                 ctx.prev_rec_url = mkurl(ctx.prev_search_record, prev_args, stop_parms);
         %]
         <a class='np_nav_link classic_link' title='[% l("Previous Record") %]'
-            href='[% ctx.prev_rec_url %]' rel="nofollow" vocab=""><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %]</a>
+            href='[% ctx.prev_rec_url %]'><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %]</a>
         [% END %]
 
         [% 
@@ -30,7 +30,7 @@
                 ctx.next_rec_url = mkurl(ctx.next_search_record, next_args, stop_parms);
         %]
         <a class='np_nav_link classic_link' title='[% l("Next Record") %]'
-            href='[% ctx.next_rec_url %]' rel="nofollow" vocab="">[% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
+            href='[% ctx.next_rec_url %]'>[% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
         [% END %]
 
     </div>
index 8f47bf6..4be6b83 100644 (file)
@@ -26,7 +26,7 @@ BLOCK render_series;
                 url = mkurl(ctx.opac_root _ '/results',
                     { qtype=>'series', query=>total_term }, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms)
                 );
-                series = series _ '<a href="' _ url _ '" rel="nofollow" vocab="">' _ single_term _ '</a> ';
+                series = series _ '<a href="' _ url _ '">' _ single_term _ '</a> ';
             END;
             FOREACH link880 IN graphics;
                 link = link880.value | html;
index 9fd07c5..6b99b13 100644 (file)
@@ -67,7 +67,7 @@
 
                 %]<a href="[%-
                        mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms))
-                -%]" rel="nofollow" vocab="">[% single_term %]</a> [%-
+                -%]">[% single_term %]</a> [%-
 
             END;
             IF all_terms.size; "<br/>"; END;
index cccf18b..86de798 100644 (file)
@@ -24,7 +24,7 @@
                             href = mkurl('', {page => page - 1});
                     -%]
                     <a class='[% class %]' href='[% href %]' 
-                        title='[% l("Previous page") %]' rel="nofollow" vocab=""><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %] </a>
+                        title='[% l("Previous page") %]'><span class="nav_arrow_fix">&#9668;</span> [% l('Previous') %] </a>
                     [%- END;
 
                         # show links to 4 previous pages, the current page, and 3 more pages.
@@ -39,7 +39,7 @@
                                     IF pageitr == page; %]
                                         <span class='results-paginator-selected'>[% pageitr + 1%]</span>
                                     [% ELSE %]
-                                        <a href="[% mkurl('', {page => pageitr}) %]" rel="nofollow" vocab="">[% pageitr + 1%]</a>
+                                        <a href="[% mkurl('', {page => pageitr}) %]">[% pageitr + 1%]</a>
                                 [%  END;
                                     added = added + 1;
                                     IF added == 8; LAST; END;
@@ -54,7 +54,7 @@
                             href = mkurl('', {page => page + 1});
                     -%]
                     <a class='[% class %]' href='[% href %]' 
-                        title='[% l("Next page") %]' rel="nofollow" vocab=""> [% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
+                        title='[% l("Next page") %]'> [% l('Next') %] <span class="nav_arrow_fix">&#9658;</span></a>
                     [%- END; -%]
                 </span>
     </span>
index ac13ce0..bd23358 100644 (file)
@@ -7,8 +7,8 @@
     <div id="search-box">
         <span class="search_catalog_lbl mobile_hide">[% l('Search the Catalog') %]</span>
         <span class="adv_search_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/advanced', {},  expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]"
-            id="home_adv_search_link" rel="nofollow" vocab="">[% l('Advanced Search') %]</a></span>
-        <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, expert_search_parms.merge(general_search_parms, facet_search_parms, ['fi:has_browse_entry'])) %]" rel="nofollow" vocab="">[% l('Browse the Catalog') %]</a></span>
+            id="home_adv_search_link">[% l('Advanced Search') %]</a></span>
+        <span class="browse_the_catalog_lbl"><a href="[% mkurl(ctx.opac_root _ '/browse', {}, expert_search_parms.merge(general_search_parms, facet_search_parms, ['fi:has_browse_entry'])) %]">[% l('Browse the Catalog') %]</a></span>
     </div>
     <div class="searchbar">
         <span class='search_box_wrapper'>
     [% UNLESS took_care_of_form %]</form>[% END %]
     [% IF (is_advanced AND NOT is_special) AND CGI.param('qtype') %]
     <div class="opac-auto-102">
-        [ <a href="[% mkurl(ctx.opac_root _ '/advanced') %]" rel="nofollow" vocab="">[%
+        [ <a href="[% mkurl(ctx.opac_root _ '/advanced') %]">[%
             l('Refine My Original Search')
         %]</a> ]
     </div>
index a89c7bf..37c652c 100644 (file)
@@ -14,7 +14,7 @@
     page_count = (!ctx.page_size.defined || !ctx.hit_count.defined || ctx.page_size == 0) ? 1 : POSIX.ceil(ctx.hit_count / ctx.page_size);
 
     # We don't want search engines indexing search results
-    ctx.metalinks.push('<meta name="robots" content="noindex">');
+    ctx.metalinks.push('<meta name="robots" content="noindex,follow">');
 
     PROCESS "opac/parts/misc_util.tt2";
     PROCESS get_library;
@@ -37,7 +37,7 @@
           </div>
           [% IF CGI.param('query') %]
           <div>
-            <a href="[% mkurl(ctx.opac_root _ '/results', {}, ['metarecord']); %]" rel="nofollow" vocab="">
+            <a href="[% mkurl(ctx.opac_root _ '/results', {}, ['metarecord']); %]">
               [% l('&#9668; Return to Grouped Search Results') %]
             </a>
           </div>
         <div id="results_header_bar" [%- IF ctx.metarecord %]class="hidden"[% END -%]>
             <div id="results_header_inner">
                 <div class="results_header_btns">
-                    <a href="[% mkurl(ctx.opac_root _ '/home', {$loc_name => loc_value}, 1) %]" rel="nofollow" vocab="">[% l('Another Search') %]</a>
+                    <a href="[% mkurl(ctx.opac_root _ '/home', {$loc_name => loc_value}, 1) %]">[% l('Another Search') %]</a>
                 </div>
                 <div class="results_header_btns">
-                    <a href="[% mkurl(ctx.opac_root _ '/advanced',{}, expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]" rel="nofollow" vocab="">[% l('Advanced Search') %]</a>
+                    <a href="[% mkurl(ctx.opac_root _ '/advanced',{}, expert_search_parms.merge(browse_search_parms, facet_search_parms)) %]">[% l('Advanced Search') %]</a>
                 </div>
                 <div id="refine_hits" class="results_header_btns result_block_visible"><a onclick="getFacety();">[% l('Refine these results') %]</a></div>
                 <div id="return_to_hits" class="results_header_btns"><a onclick="getResulty();">[% l('Back to results') %]</a></div>
@@ -59,7 +59,7 @@
                     [%- IF ctx.user; %]
                     <a href="[% mkurl(ctx.opac_root _ '/myopac/lists') %]">[% l('View My List') %]</a>
                     [%- ELSE %]
-                    <a href="[% mkurl(ctx.opac_root _ '/mylist') %]" rel="nofollow" vocab="">[% l('View My List') %]</a>
+                    <a href="[% mkurl(ctx.opac_root _ '/mylist') %]">[% l('View My List') %]</a>
                     [%- END %]
                 </div>
                 [% END %]
@@ -70,8 +70,8 @@
                     [%- IF show_more_details.default != 'hide' -%]
                     <div class='results_header_sel' id='simple-detail-view-links'>
                         [% IF CGI.param('detail_record_view') %]
-                        <a href="[% mkurl('', {detail_record_view => ''}) %]" rel="nofollow" vocab="">[% l('Show Fewer Details') %]</a> [% ELSE %]
-                        <a href="[% mkurl('', {detail_record_view => 1}) %]" rel="nofollow" vocab="">[% l('Show More Details') %]</a>
+                        <a href="[% mkurl('', {detail_record_view => ''}) %]">[% l('Show Fewer Details') %]</a> [% ELSE %]
+                        <a href="[% mkurl('', {detail_record_view => 1}) %]">[% l('Show More Details') %]</a>
                         [% END %]
                     </div>
                     [%- END -%]