RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

Canonical URL Rails Plugin

Canonical URLs are the new hints that let you specify a single URL as ‘canon’ for search engines to increase your search index coherency. Implement it in your Rails apps with the new canonical-url plugin.

Comments

Wow. Do you really need a plugin for this?

As I said on the (presumably from the same person) comment on the blog: I prefer wrapping functionality in plugins, even when small and simple. It affords me the ability to stop worrying about it and obviates the need for copy and pasting between projects. I also have some plans for this plugin to extend the functionality further.

If you’d rather not use it, I won’t twist your arm.

Anon: It’s easy to think of plugins as being “heavy” things, but they’re really not. Indeed, this sort of thing was the original motivation for plugins.. the ability to pull out minor pieces of edge functionality from Rails core into a separate form. Most plugins do tend to be quite heavy, alas, but that wasn’t the goal.

This isn’t edge functionality though. It’s a single line of HTML code. It belongs in your view, not your controller. Putting it in the controller like one of the example is simply wrong.

Where this belongs is in a helper, which is all the plugin does anyways.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in