SEO & Sitemaps
RailsFast has been designed for SEO and discoverability from the ground up. Your project, immediately upon deployment, should score 100/100 on SEO and close to 100/100 on overall performance on Google PageSpeed Insights:
Other than technical improvements and good technical architecture, your main two ways of affecting on-page SEO on your RailsFast app are: metadata and the sitemap.
Metadata
We use the meta-tags gem to handle on-page metadata. Everything is already configured and you'll see examples throughout the codebase, but to make it explicit, you can set your page metadata inside views like this:
<% title "My page" %>
<% description "This is the SEO description for my page" %>
Or in the corresponding controller action:
@page_title = "My page"
@page_description = "My SEO description"
You can also set your page OG card image like this:
set_meta_tags og: { image: "https://example.com/image.jpg" }
Sitemaps
Your app sitemap is available at /sitemaps/sitemap.xml.gz
You can configure what URLs go in the sitemap by editing your config/sitemap.rb file. You can dynamically add thousands of URLs by iterating over all your database records. We leverage the sitemaps-generator gem for this, read their docs to know what's possible!
You can also enable automatic sitemap discovery in your robots.txt file by uncommenting the sitemap line at the end of the file.
TODO: make sure Cloudflare is not blocking sitemaps / are readable by GSC
Slugs
If you want to create SEO-friendly URLs, I recommend using the slugifiable gem.
This will allow you to have semantic URLs like
https://myapp.com/products/big-red-backpack
instead of
https://myapp.com/products/14
The slugifiable gem does not come pre-configured by default in RailsFast because it's very app-dependent, but it should take you just ~5 minutes to set up!