Rails SEO Settings meta-tags

Configuring SEO Settings for Meta Tags in Rails

Effective configuration of meta-tags for SEO settings in Rails, the web application framework for the Ruby programming language.

Shou Arisaka
3 min read
Nov 16, 2025

Effective configuration of meta-tags for SEO settings in Rails, the web application framework for the Ruby programming language.

kpumuk/meta-tags: Search Engine Optimization (SEO) for Ruby on Rails applications.

layout

<% keywords 'aptnote' %>
<% set_meta_tags canonical: "https://www.aptnote.net#{request.fullpath}" %>
<%= display_meta_tags site: 'APTNOTE', reverse: true, separator: '-' , follow: true, index: true  %>

Each view (example of index.html.erb)

<h1><%= title "Welcome to APTNOTE" %></h1>
<% description "APTNOTE is a simple note app. User authentication features completely protect your notes." %>

Explanation

First, you should write common SEO settings in the layout. For example, meta keywords. This is probably sufficient to have just one for the entire app. Well, it might depend on what kind of app it is. For example, if it’s a blog service, it would be better if individual users could dynamically set keywords = meta keywords on individual pages, and in such cases, you might not want to set meta keywords individually.

Also, as introduced in other articles, canonical is set to prevent duplicate content with the Heroku domain. Please rewrite the domain part.

display_meta_tags is a method that displays all the meta tags set up to that point. You can also define them at the same time. There are two key points here.

First, the meaning of reverse and separator can be understood by referring to this issue:

How to change row of site-title and title by override? · Issue #172 · kpumuk/meta-tags

The reason for changing the order is that, although it’s a matter of preference, there’s a sort of convention to put the site name at the end.

This also depends on the app content… For example, in a blog service, it would be fatal if the site name came first. In basic SEO, the beginning of the title tag is considered more important, and the end is considered less important.

Also, text that doesn’t appear in search results, when there are too many characters, etc., becomes even less important. Not only that, from the perspective of users who search, if they can’t understand the page content = title because of the site name, it damages usability, which could also be called user SEO. Summarizing all this, the site name = app name should be at the end.

Second, follow: true, index: true is added to index/follow all content. Please remove this depending on the case. This is also SEO trivia, but it’s said that SEO differences can arise between doindex and when no index specification is made. In other words, it’s important to explicitly state to index.

Now, about the view. In the view, you’ll probably set description and title. Or possibly plus meta keywords. So description and title need to be placed in each view individually and rewritten.

That’s all.

Share this article

Shou Arisaka Nov 16, 2025

🔗 Copy Links