LoginSignup
2
2

More than 3 years have passed since last update.

railsアプリ開発時にやったSEO対策メモ

Last updated at Posted at 2019-05-07

概要

railsでQAサイトを作った際のSEOメモ

パンくず設置

gretelを導入。

httpsリダイレクト

config/enviroments/production.rb
config.force_ssl = true

上記でhttpsにリダイレクトされるようになる。httpとhttpsどちらにもアクセスが有るとgoogleの評価が分かれるのでリダイレクトさせる。

tag

metatagを導入して下記の対策を行う。導入方法は下記記事に記載。

devise周りのnoindex化

<% set_meta_tags noindex: true %>

deviseを導入するとuser登録周りのページが自動で作られるがこれらのページはindexされてもしょうがないのでmetatagでnoindexに。

titleのユニーク化

SEO的にはtitleはユニークなものにしたほうがいい。違うページだと認識しにくいので。これはmetatagで下記のようにviewごとに書いて出し分けるのが一番ラクそう。

<% set_meta_tags title: "タイトル1" %>
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2