Skip to content

Commit

Permalink
Merge pull request #477 from trln/TD-1392-rss
Browse files Browse the repository at this point in the history
Fix RSS feeds. Fixes TD-1392.
  • Loading branch information
kazymovae authored Dec 11, 2024
2 parents f9787b7 + cc5b972 commit bc0ff53
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
8 changes: 8 additions & 0 deletions app/views/catalog/_document.rss.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# TRLN CUSTOMIZATION: add title & responsibility to <title> tag; omit <author>. See:
# https://github.com/projectblacklight/blacklight/blob/release-8.x/app/views/catalog/_document.rss.builder
xml.item do
xml.title(document.title_and_responsibility)
xml.link(polymorphic_url(search_state.url_for_document(document)))
end
4 changes: 0 additions & 4 deletions app/views/catalog/_document_default.rss.builder

This file was deleted.

19 changes: 12 additions & 7 deletions app/views/catalog/index.rss.builder
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
# frozen_string_literal: true

# TRLN CUSTOMIZATION: Fix link to catalog. See:
# https://github.com/projectblacklight/blacklight/blob/release-8.x/app/views/catalog/index.rss.builder
xml.instruct! :xml, version: '1.0'
xml.rss(version: '2.0') do
xml.channel do
xml.title(t('blacklight.search.title', application_name: application_name))
xml.title(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params),
application_name: application_name))
# BL core renders <link> with catalog.rss, so we fix it here
# xml.link(search_action_url(search_state.to_h.merge(only_path: false)))
xml.link(search_action_url(params.merge(format: '').to_unsafe_h))
xml.description(t('blacklight.search.title', application_name: application_name))
xml.description(t('blacklight.search.page_title.title', constraints: render_search_to_page_title(params),
application_name: application_name))
xml.language('en-us')
@document_list.each_with_index do |document, document_counter|
xml << Nokogiri::XML.fragment(
render_document_partials(document,
blacklight_config.view_config(:rss).partials,
@response.documents.each_with_index do |document, document_counter|
xml << render_xml_partials(document, blacklight_config.view_config(:rss).partials,
document_counter: document_counter)
)
end
end
end

0 comments on commit bc0ff53

Please sign in to comment.