Repository: optic14n
Canonicalise URLs
- GitHub
- optic14n
- Ownership
- #govuk-publishing-platform owns the repo. #govuk-publishing-platform-system-alerts receives automated alerts for this repo.
- Category
- Gems
We’d like to set some cookies to understand how you use this site and remember your settings.
We also use cookies set by other sites to help us deliver content from their services.
You have accepted additional cookies. You can change your cookie settings at any time.
You have rejected additional cookies. You can change your cookie settings at any time.
Canonicalise URLs
Canonicalises URLs.
Add this line to your application’s Gemfile:
gem 'optic14n'
And then execute:
$ bundle
Or install it yourself as:
$ gem install optic14n
Parse a BLURI
like this:
bluri = BLURI('http://somewhere.com/?a=1&b=2&c=3')
Canonicalize it according to the Previously-Established Rules thusly:
bluri.canonicalize!
You can also do site-specific stuff if you know some of the querystring will be valuable
bluri.canonicalize!(allow_query: :all)
bluri.canonicalize!(allow_query: [:a, :c])
# or
bluri.canonicalize!(allow_query: ['a', 'c'])
This is a gem for canonicalising HTTP URIs such that we can boil our input set of URIs down to something that is much smaller than it would otherwise be. We do this aggressively by:
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)