ajbraus
ajbraus

Reputation: 2999

Duplicate routes / metatags from Friendly_id

Google just let me know that I have duplicate meta tags. This is coming because I have duplicate routes from setting friendly_id

/posts/2
/posts/awesome-post-about-ponys

How do I make the first one invisible to google/the DMZ?

Upvotes: 1

Views: 44

Answers (1)

Mike Szyndel
Mike Szyndel

Reputation: 10592

The method I'm using in a similar case is to manually catch non-nice url and make a redirect

if request.path != post_path(@post)
  redirect_to @post, status: :moved_permanently and return
end

Upvotes: 1

Related Questions