Created
February 7, 2017 15:42
-
-
Save lachlanjc/e314bef3654654d26b9f2499d1663282 to your computer and use it in GitHub Desktop.
Make Schema metadata generation easy in Rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= make_scheme org_schema %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SchemaHelper | |
def make_schema(data = org_schema) | |
content_tag 'script', data.to_json.html_safe, type: 'application/ld+json' | |
end | |
def org_schema | |
{ | |
'@context': 'http://schema.org', | |
'@type': 'Organization', | |
name: COMPANY_NAME | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment