From ee960bd45f7535aec058d3984891e21b255ace12 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 15 Apr 2024 14:21:03 +0000 Subject: [PATCH] Bug 16567: Correct RSS feed validity errors This patch corrects a few markup errors in the XML feeds to make the feeds validate correctly. The template has been largely re-indented to improve readability and eliminate tab characters. To test, apply the patch and perform a search in the OPAC. - Open the RSS link appearing after the "Your search returned..." header. - Depending on how your browser handles XML documents you may need to view source on the page to see the actual XML markup. - Copy the source and paste it into the W3C feed validator: https://validator.w3.org/feed/#validate_by_input - The feed should be found to be valid. - In my tests you'll get a "Recommendation" about "Self reference doesn't match document location." I think this recommendation doesn't apply. Perform the same test with the other two available formats: Atom and OpenSearch: - Change the end of the RSS feed url from '&format=rss' to '&format=atom' and validate the result. - The same "self reference" recommendation will come up, and again I think we can ignore it. - There is another recommendation about "Two entries with the same value for atom:updated." The updated time is set to the same time as the feed itself (the time when the feed was generated. Maybe this is incorrect. If so we need a follow-up that exposes a different value to the template. biblio.datecreated maybe? - Change the end of the feed url from '&format=atom' to '&format=OpenSearchDescription' and validate that result. Signed-off-by: Brendan Lawlor Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- .../bootstrap/en/modules/opac-opensearch.tt | 350 ++++++++++++------ 1 file changed, 237 insertions(+), 113 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt index 1d45fb5b81..14e7889834 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt @@ -1,125 +1,249 @@ - +[%- FILTER collapse -%] [%- USE raw -%] [%- USE Koha -%] [%- PROCESS 'html_helpers.inc' -%] -[% IF ( opensearchdescription ) %] - - [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Library catalog[% END %] - Search the [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha library[% END %] catalog - UTF-8 - - [% IF ( Koha.Preference('OpacFavicon') ) %] - [% Koha.Preference('OpacFavicon') | url %] - [% ELSE %] - [% Koha.Preference('OPACBaseURL') | url %][% interface | url %]/[% theme | url %]/images/favicon.ico - [% END %] - - - - -[% ELSE %] + -[% IF ( rss ) %] - - - <![CDATA[[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]]]> - [% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&format=rss - - - [% total | html %] - [% offset | html %] - [% IF ( results_per_page ) %] - [% results_per_page | html %] - [% ELSE %] - 20 - [% END %] - [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - - -[% END %] + [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] + + [% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %] + + [% timestamp | html %] + +
+ [% IF ( OPACAmazonCoverImages ) %] + [% IF ( SEARCH_RESULT.normalized_isbn ) %] + + [% END %] + [% END %] -[% IF ( atom ) %] - - [% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&format=atom - [% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %] - - [% timestamp | html %] - - [% LibraryName | html %] - - - [% total | html %] - [% page | html %] - [% IF ( results_per_page ) %] - [% results_per_page | html %] - [% ELSE %] - 20 - [% END %] - - - - - - - - + [% IF ( SyndeticsEnabled ) %] + [% IF ( SyndeticsCoverImages ) %] + [% IF ( SEARCH_RESULT.content_identifier_exists ) %] + + [% ELSE %] + + [% END %] + [% END %] + [% END %] + [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] + [% IF ( BakerTaylorEnabled ) %] + [% IF bt_id %] + See Baker & Taylor + [% END %] + [% END %] - [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - - [% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %] - [% OPACBaseURL | url %][% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %] - - [% SEARCH_RESULT.timestamp | html %] - [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %] - + [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %] + [% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %] + [% IF custom_cover_image_url %] + Cover image + [% END %] + [% END %] - - - [% END %] - -[% END %] + [% IF ( SEARCH_RESULT.author ) %] + By [% SEARCH_RESULT.author | html %].
+ [% END %] + [% IF ( SEARCH_RESULT.place ) %] + [% SEARCH_RESULT.place | html %] + [% END %] + [% IF ( SEARCH_RESULT.publishercode ) %] + [% SEARCH_RESULT.publishercode | html %] + [% END %] + [% IF ( SEARCH_RESULT.publicationyear ) %] + [% SEARCH_RESULT.publicationyear | html %] + [% ELSE %] + [% IF ( SEARCH_RESULT.copyrightdate ) %] + [% SEARCH_RESULT.copyrightdate | html %] + [% END %] + [% END %] + [% IF ( SEARCH_RESULT.pages ) %] + .
[% SEARCH_RESULT.pages | html %] + [% END %] + [% IF ( SEARCH_RESULT.notes ) %] + , [% SEARCH_RESULT.notes | html %] + [% END %] + [% IF ( SEARCH_RESULT.size ) %] + [% SEARCH_RESULT.size | html %].
+ [% END %] + [% IF ( SEARCH_RESULT.isbn ) %] + [% SEARCH_RESULT.isbn | html %] + [% END %] -[% END %] + [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %] + Place hold on [% SEARCH_RESULT.title | html %] + [% END %] +
+
+ [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %] +
+ [% END %] + + [% END # /IF atom %] + [% END # /IF opensearchdescription %] +[% END # /FILTER %] -- 2.39.5