Rails developers often use
to_param to add more information to the url. Taking this very page as an example:
We can clear get an idea of what this page is about. Therefore search engines favours this kind of urls.
However, if we just override
to_param, we would also see other urls getting changed. One most notable example would be edit path:
I think this can cause issues as the seo-friend param can potentially get very long. Then it would be difficult to notice the
edit in the url. Also it may not be that useful to do SEO on action urls (rather than the content urls). We probably will never want edit page to appear on search engines.
I think instead, we should conditionally do SEO on urls that needs it. One way to do this is to have our own version of the url helpers. For example, we can define
post_path like this:
This means only show/delete/update paths will be SEO friendly. Other paths (especially custom actions) will be unaffected.