Autodiscovery

by Christian Ledermann last modified Dec 30, 2008 05:48 PM
Search engines that publish OpenSearch description documents can assist search clients in the discovery of OpenSearch interfaces through the use of "link" elements. Search engines that support OpenSearch should include a reference to the related OpenSearch description document on each page of search results.

HTML and XHTML documents may reference related OpenSearch description documents via the HTML 4.0 <link/> element.

Search Template

To enable autodiscovery for your OpenSearch change:

<metal:block metal:fill-slot="head_slot">
<link rel="alternate" title="RSS 1.0" type="application/rss+xml"
tal:condition="request/SearchableText|nothing"
tal:attributes="href string:$here_url/search_rss?${request/QUERY_STRING}"/>
</metal:block>
to:
<metal:block metal:fill-slot="head_slot">
<!--link rel="alternate" title="RSS 1.0" type="application/rss+xml"
tal:condition="request/SearchableText|nothing"
tal:attributes="href string:$here_url/search_rss?${request/QUERY_STRING}"/-->
<link rel="alternate" title="RSS 2.0 Open Search" type="application/rss+xml"
tal:condition="request/SearchableText|nothing"
tal:attributes="href string:$here_url/plos-rss.xml?${request/QUERY_STRING}"/>
<link rel="alternate" title="Atom Open Search" type="application/atom+xml"
tal:condition="request/SearchableText|nothing"
tal:attributes="href string:$here_url/plos-atom.xml?${request/QUERY_STRING}"/>
<link rel="search" type="application/opensearchdescription+xml" title="Open Search Description"
tal:attributes="href string:${here_url}/plos-description.xml"/>
</metal:block>

in the <head> section of your search template (portal_skins/plone_forms/search.pt)

In the same template you might also want to change:
       <tal:syndicate condition="syntool/isSiteSyndicationAllowed">
<a href="" tal:attributes="href string:$here_url/search_rss?${request/QUERY_STRING}">
<img i18n:attributes="title title_rss_feed; alt label_rss_feed;"
tal:attributes="src string:$portal_url/rss.gif"
src="rss.gif"
alt="RSS Feed"
title="RSS feed of these search results" />
</a>
</tal:syndicate>

to:

        <tal:syndicate condition="syntool/isSiteSyndicationAllowed">
<a href="" tal:attributes="href string:$here_url/plos-rss.xml?${request/QUERY_STRING}">
<img i18n:attributes="title title_rss_feed; alt label_rss_feed;"
tal:attributes="src string:$portal_url/rss.gif"
src="rss.gif"
alt="RSS Feed"
title="RSS feed of these search results" />
</a>
<a href="" tal:attributes="href string:$here_url/plos-atom.xml?${request/QUERY_STRING}">
<img tal:attributes="src string:$portal_url/atom.png"
src="atom.png"
alt="Atom Feed"
title="Atom feed of these search results" />
</a>
</tal:syndicate>

Main Template

To enable autodiscovery on all your pages add:
<link rel="search" type="application/opensearchdescription+xml" title="Open Search Description"
tal:attributes="href string:${portal_url}/plos-description.xml"/>
to the <head> section of your main_template.