# 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 but bad # in app/views/layouts/application.html.erb # In each view content_for(:title, @product.title) content_for(:title, @product.description) # Best 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 Then combine in view: <%= og_tags(standard_og_stuff(@product), { :type => 'video.tv_show', :other_tag => 'something' }) %>