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/public/robots.txt b/public/robots.txt index f6ca098a0..181e6f3ff 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -1,5 +1,5 @@ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: -User-agent: * -Disallow: / +# User-agent: * +# Disallow: / 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