any way to make Rails + this gem create hyphenated urls, especially for static pages such as /blue_socks to become /blue-socks
jpwynn opened this issue · 1 comments
Does this gem (or gem in combination with some other technique) facilitate replacing Rails' hardwired "underscore" paths and urls with the more SEO-friendly "hyphenated" paths and urls.
Specifically is there any way given a controller method def blue_socks ....
to have the auto-magic rails routes and paths and urls be in the form blue-socks
(which Google will understand as "blue socks" instead of blue_socks
(which to Google is just a non-word)?
Having installed this gem to play with it, it's nice on one hand to have an easy way to add a canonical to the layout, but the real SEO issue for Rails apps, it seems to me, is undoing Rails' (tragically IMO) baked-in "underscore" assumption for all routes, paths, urls.
Since Google explicitly states hyphenated words is better, surely there is some way to accomplish that with Rails?
Source for others: https://developers.google.com/search/docs/crawling-indexing/url-structure
The Rails Router DSL allows for manual specification of URLs, it just makes it verbose and takes time. I recommend adding an 'except' clause to your resource definitions and manually redefining the relevant GET
paths using whatever form you most prefer.
Cheers.