Skip to content

Quick and configurable canonical tag to use in Rails views.

License

Notifications You must be signed in to change notification settings

kolide/canonical-rails

 
 

Repository files navigation

CanonicalRails

latest builds

A number of articles exist explaining the issue concisely and at length:

Guide

Take a look at this blog post that can guide you through the idea and the setup: Easily add canonical URLs to your Rails app

Challenge

I've seen a lot of folks do more harm by neglecting canonicalization altogether than by applying too narrowly and conservatively, so here is an attempt to let people start modestly without spending too much time on it and whitelist parameters as they need to.

Install

gem 'canonical-rails', github: 'jumph4x/canonical-rails'

Usage

First, generate the config

rails g canonical_rails:install

Then find it in config/initializers/ as canonical_rails.rb

Finally, include the canonical_tag helper inside the head portion of your HTML views:

  <%= canonical_tag -%>

Cred

Originally developed for FCP Euro - High Quality European Car Parts.

About

Quick and configurable canonical tag to use in Rails views.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%