Skip to content

Instantly share code, notes, and snippets.

@donrestarone
Created February 3, 2021 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donrestarone/79b3aef41cfdf1dfaa65bf54617b4e62 to your computer and use it in GitHub Desktop.
Save donrestarone/79b3aef41cfdf1dfaa65bf54617b4e62 to your computer and use it in GitHub Desktop.
a simple rails controller that implements meta tags
class HomeController < ApplicationController
def index
@page_title = "Your Page Title Here"
@page_description = "Your Page Description Here"
@page_keywords = "comma, separated, keywords, here"
set_meta_tags(
og: {
image: 'your::aws::s3:image_path',
title: @page_title,
description: @page_description
},
twitter: {
image: {
_: 'your::aws::s3:image_path',
width: 1200,
height: 628,
},
card: 'summary_large_image',
}
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment