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 canonical-rails gem and handroll our own #4713

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ gem 'puma', '~> 6.5'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

# Canonical meta tag
gem 'canonical-rails'

# Decorate logic to keep it out of the views and helper methods
gem 'draper'

Expand Down
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,6 @@ GEM
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.3)
canonical-rails (0.2.16)
actionview (>= 4.1, < 7.3)
capybara (3.40.0)
addressable
matrix
Expand Down Expand Up @@ -756,7 +754,6 @@ DEPENDENCIES
brakeman
bullet
byebug
canonical-rails
capybara (>= 2.15)
cloudfront-rails
colorize
Expand Down
5 changes: 4 additions & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<title><%= yield :page_title %> - Publish teacher training courses - GOV.UK</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= canonical_tag %>

<% url = URI(request.url.split("?").first) %>
<%= tag.link(href: url.path.ends_with?("/") ? url.to_s : "#{url}/", rel: "canonical") %>
<%= tag.meta(property: "og:url", content: url.path.ends_with?("/") ? url.to_s : "#{url}/") %>

<%= tag.meta(name: "viewport", content: "width=device-width, initial-scale=1") %>
<%= tag.meta(property: "og:image", content: image_path("govuk-opengraph-image.png")) %>
Expand Down
5 changes: 4 additions & 1 deletion app/views/layouts/find_layout.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<title><%= yield :page_title %> - <%= t("service_name.find") %> - GOV.UK</title>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= canonical_tag %>

<% url = URI(request.url.split("?").first) %>
gms-gs marked this conversation as resolved.
Show resolved Hide resolved
<%= tag.link(href: url.path.ends_with?("/") ? url.to_s : "#{url}/", rel: "canonical") %>
<%= tag.meta(property: "og:url", content: url.path.ends_with?("/") ? url.to_s : "#{url}/") %>

<%= tag.meta(name: "viewport", content: "width=device-width, initial-scale=1") %>
<%= tag.meta(property: "og:image", content: image_path("govuk-opengraph-image.png")) %>
gms-gs marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
30 changes: 0 additions & 30 deletions config/initializers/canonical_rails.rb

This file was deleted.

Loading