Skip to content

Commit

Permalink
Add FAQ Page schema to detailed guides
Browse files Browse the repository at this point in the history
They are the same shape as answers, so we should be OK to reuse that template.
  • Loading branch information
sihugh committed Aug 14, 2020
1 parent 9756af9 commit 6d37f52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/content_items/detailed_guide.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% content_for :extra_head_content do %>
<%= machine_readable_metadata(
schema: :article
schema: :faq
) %>
<% end %>

Expand Down
8 changes: 8 additions & 0 deletions test/integration/detailed_guide_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,12 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest

assert page.has_css?(".metadata-logo[alt='European structural investment funds']")
end

test "renders FAQ structured data" do
setup_and_visit_content_item("detailed_guide")
faq_schema = find_structured_data(page, "FAQPage")

assert_equal faq_schema["name"], @content_item["title"]
assert_not_equal faq_schema["mainEntity"], []
end
end

0 comments on commit 6d37f52

Please sign in to comment.