# It is common in any rails application to have some meta tags in your HTML as title, description, keywords , fb meta tags,... # BAD # In app/views/layouts/application.html.erb # In each controller @description = @image_url = # Better # in app/views/layouts/application.html.erb # In each view content_for(:title, @product.title) content_for(:title, @product.description) # Better <%= og_tags(standard_og_stuff(@product), { :type => 'website', :other_tag => 'something' }) %> # app/helpers/application_helper.rb def og_tags(*tags) content = tags.reduce({}) do |result, set| result.merge! set end raw(content.map do |key, value| tag :meta, content: value, property: "og:#{key}" end.join("\n")) end # Then a helper method that pulls standard attrs (name, desc, image, ...) from a piece of content: def standard_og_stuff(content) { title: content.name, description: content.description } end