Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hardcoded FAQPage schema #1587

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 0 additions & 69 deletions app/presenters/machine_readable/yaml_faq_page_schema_presenter.rb

This file was deleted.

4 changes: 1 addition & 3 deletions app/views/content_items/guide_single.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
) %>
<% end %>

<% if MachineReadable::YamlFaqPageSchemaPresenter.configured?(@content_item) %>
<script type="application/ld+json">
<%= raw MachineReadable::YamlFaqPageSchemaPresenter.new(@content_item).structured_data.to_json %>
<%= raw MachineReadable::GuideFaqPageSchemaPresenter.new(@content_item).structured_data.to_json %>
</script>
<% end %>

<% content_for :simple_header, true %>

Expand Down
87 changes: 0 additions & 87 deletions config/machine_readable/voting-in-the-uk.yml

This file was deleted.

14 changes: 0 additions & 14 deletions test/integration/guide_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@ class GuideTest < ActionDispatch::IntegrationTest
assert_nil faq_schema
end

# The schema config is in /config/machine_readable/voting-in-the-uk.yml
test "voting in the UK guide shows hard coded FAQ schema" do
setup_and_visit_voting_guide

faq_schema = find_structured_data(page, "FAQPage")
q_and_as = faq_schema["mainEntity"]

assert_equal faq_schema["@type"], "FAQPage"
assert_equal faq_schema["headline"], "How to vote"
assert_equal faq_schema["description"], "<p>You need to <a href=\"/register-to-vote?src=schema\">register to vote</a> before you can vote in UK elections or referendums.</p> <p>If you’re eligible, you can vote in person on the day of the election at a named polling station. You can also apply for a postal or proxy vote instead.</p>\n"

assert_equal 8, q_and_as.count
end

test "voting in the UK guide shows all chapters on a single page" do
content_item = setup_and_visit_voting_guide
part_titles = content_item["details"]["parts"].map { |part| part["title"] }
Expand Down