diff --git a/app/views/content_items/guide.html.erb b/app/views/content_items/guide.html.erb index 5b19c4643..d1c30a3b9 100644 --- a/app/views/content_items/guide.html.erb +++ b/app/views/content_items/guide.html.erb @@ -1,6 +1,6 @@ <% content_for :extra_head_content do %> <%= machine_readable_metadata( - schema: :article, + schema: :faq, canonical_url: @content_item.canonical_url ) %> <% end %> diff --git a/test/integration/guide_test.rb b/test/integration/guide_test.rb index 90c634f4a..227e18cc5 100644 --- a/test/integration/guide_test.rb +++ b/test/integration/guide_test.rb @@ -76,4 +76,14 @@ class GuideTest < ActionDispatch::IntegrationTest assert_has_component_title(title) end + + test "guides show the faq page schema" do + setup_and_visit_content_item('guide') + + schema_sections = page.find_all("script[type='application/ld+json']", visible: false) + schemas = schema_sections.map { |section| JSON.parse(section.text(:all)) } + + qa_page_schema = schemas.detect { |schema| schema["@type"] == "FAQPage" } + assert_equal qa_page_schema["headline"], @content_item['title'] + end end