No commit activity in last 3 years
No release in over 3 years
This gem is based on canonical-rails by Denis Ivanov,I only delete the port in the url and delete the lower-case method in the code.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

< 5.3, >= 4.1
 Project Readme

ZhuleiCanonicalRails

Build Status

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

A project by Downshift Labs, Ruby on Rails, Performance tuning and Spree Commerce projects.