kpumuk / meta-tags

Search Engine Optimization (SEO) for Ruby on Rails applications.
MIT License
2.73k stars 275 forks source link

Canonical undefined when trying to set in the view #89

Closed aapljack closed 9 years ago

aapljack commented 9 years ago

I am trying to set the canonical URL in the view of a project and it always comes back undefined. I can successfully set it in the controller, but I want to be able to override it in the view occasionally.

This is what I am putting in the view..

<% canonical "http://google.com" %>

And I get this error..

undefined method `canonical' for #<#Class:0x007ff6b7b2b550:0x007ff6b52716f0>

I'm using.. ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14] Rails 4.2.3 Mac OS X 10.10.4

I am able to set the other tags in the view.

Any advice?

kpumuk commented 9 years ago

There is no canonical helper. But you can use `<% set_meta_tags canonical: 'http://google.com' %>