Class: SeoTag
- Inherits:
-
LiquidumTag
- Object
- LiquidumTag
- SeoTag
- Defined in:
- lib/scribo/liquid/tags/seo_tag.rb
Overview
Adds SEO tags
Basic usage:
{%seo%}
Instance Method Summary collapse
Instance Method Details
#render(context) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/scribo/liquid/tags/seo_tag.rb', line 9 def render(context) super content = context.registers['content'] site = content.site request = context.registers['controller'].request %[ <!-- Begin Scribo SEO tag #{Scribo::VERSION} --> <title>#{site.properties['title']}</title> <meta name="generator" content="Scribo #{Scribo::VERSION}" /> <meta property="og:title" content="#{content.site.title}" /> <meta name="author" content="#{site.properties['author'].is_a?(String) ? site.properties['author'] : ''}" /> <meta property="og:locale" content="en_US" /> <meta name="description" content="#{site.properties['description']}" /> <meta property="og:description" content="#{site.properties['description']}" /> <link rel="canonical" href="#{request.protocol + request.host}" /> <meta property="og:url" content="#{request.protocol + request.host}" /> <meta property="og:site_name" content="#{content.site.title}" /> <script type="application/ld+json"> {"url":"#{request.protocol + request.host}","headline":"#{site.properties['title']}","name":"#{site.properties['title']}","author":{"@type":"Person","name":"#{site.properties['author']}"},"description":"#{site.properties['description']}","@type":"WebSite","@context":"https://schema.org"}</script> <!-- End Scribo SEO tag --> ] end |