diff --git a/app/views/artists/index.html.erb b/app/views/artists/index.html.erb index 311a5e69..717fa491 100644 --- a/app/views/artists/index.html.erb +++ b/app/views/artists/index.html.erb @@ -4,6 +4,10 @@ ) %> +<% content_for(:auto_discovery) do %> + <%= auto_discovery_link_tag(:atom, { format: :atom }, { title: 'Artists on jam.coop' }) %> +<% end %> + <%= render('shared/page_header', text: 'Artists') %>
diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb index fb6bdc6c..f3c68ed0 100644 --- a/app/views/artists/show.html.erb +++ b/app/views/artists/show.html.erb @@ -5,6 +5,10 @@ ) %> +<% content_for(:auto_discovery) do %> + <%= auto_discovery_link_tag(:atom, { format: :atom }, { title: "#{@artist.name} albums on jam.coop" }) %> +<% end %> +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2fd64fc1..ef48d7f5 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -10,6 +10,7 @@ <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> <%= javascript_importmap_tags %> <%= hotwire_livereload_tags if Rails.env.development? %> + <%= content_for(:auto_discovery) %> diff --git a/test/controllers/artists_controller_test.rb b/test/controllers/artists_controller_test.rb index f5882610..1b8ef849 100644 --- a/test/controllers/artists_controller_test.rb +++ b/test/controllers/artists_controller_test.rb @@ -142,6 +142,13 @@ class ArtistsControllerTestSignedOut < ActionDispatch::IntegrationTest assert_select 'p', { text: @artist.name } end + test '#index includes auto-discovery link for atom feed' do + get artists_url + + url = artists_url(format: :atom) + assert_select "head link[rel='alternate'][type='application/atom+xml'][href='#{url}']" + end + test '#index with atom format should render atom feed' do @artist.update!(name: 'Older Artist') @artist.albums << create(:album, publication_status: :published) @@ -184,6 +191,13 @@ class ArtistsControllerTestSignedOut < ActionDispatch::IntegrationTest assert_select 'p', { text: 'Album Title (pending)', count: 0 } end + test '#show includes auto-discovery link for atom feed' do + get artist_url(@artist) + + url = artist_url(@artist, format: :atom) + assert_select "head link[rel='alternate'][type='application/atom+xml'][href='#{url}']" + end + test '#show with atom format should render atom feed' do @artist.albums << create(:album, title: 'Older', publication_status: :published, released_on: 2.days.ago) @artist.albums << create(:album, title: 'Newer', publication_status: :published, released_on: 1.day.ago)