Permalink
Browse files

Metatags: description, keywords e og (facebook)

  • Loading branch information...
Godoy committed Mar 6, 2015
1 parent 820fd87 commit 5f34929a7b50b6d9d4c40fc2f9730336ee88b0c5
@@ -1,13 +1,30 @@
class EventsController < ApplicationController
include ActionView::Helpers::TextHelper
before_action :set_event, only: [:show]
def index
@events = Event.all
@page_title = 'Eventos'
@page_description = 'Eventos do projeto que mostra como aplicar regras básicas de SEO numa aplicação Ruby on Rails.'
@page_keywords = 'Evento, Event, SEO, Ruby on Rails, exemplo, Ruby, Search'
set_meta_tags :og => {
:title => @page_title,
:image => request.base_url+'/seo-rails.png',
:description => @page_description
}
end
def show
@page_title = @event.title
@page_description = truncate(@event.content, length: 150, omission: '...')
@page_keywords = @event.title.gsub ' ', ', '
set_meta_tags :og => {
:title => @page_title,
:image => request.base_url+@event.image.url,
:description => @page_description
}
end
private
@@ -1,19 +1,35 @@
class NewsController < ApplicationController
include ActionView::Helpers::TextHelper
before_action :set_news, only: [:show]
def index
@news = News.all
@page_title = 'Notícias'
@page_description = 'Notícias do projeto que mostra como aplicar regras básicas de SEO numa aplicação Ruby on Rails.'
@page_keywords = 'Notícia, News, SEO, Ruby on Rails, exemplo, Ruby, Search'
set_meta_tags :og => {
:title => @page_title,
:image => request.base_url+'/seo-rails.png',
:description => @page_description
}
end
def show
@page_title = @news.title
@page_description = truncate(@news.content, length: 150, omission: '...')
@page_keywords = @news.title.gsub ' ', ', '
set_meta_tags :og => {
:title => @page_title,
:image => request.base_url+@news.image.url,
:description => @page_description
}
end
private
def set_news
@news = News.find(params[:id])
@page_title = @news.title
end
end
@@ -1,5 +1,7 @@
class PagesController < ApplicationController
def home
@page_title = 'Projeto Exemplo'
@page_description = 'Projeto que mostra como aplicar regras básicas de SEO numa aplicação Ruby on Rails.'
@page_keywords = 'SEO, Ruby on Rails, exemplo, Ruby, Search'
end
end
View
Binary file not shown.

0 comments on commit 5f34929

Please sign in to comment.