Class: Jekyll::SeoTag::AuthorDrop
- Inherits:
-
Drops::Drop
- Object
- Drops::Drop
- Jekyll::SeoTag::AuthorDrop
- Defined in:
- lib/starter_web/_plugins/seo/j1-seo-tags.rb
Overview
A drop representing the current page’s author
Author name will be pulled from:
-
The page’s ‘author` key
-
The first author in the page’s ‘authors` key
-
The ‘author` key in the site config
If the result from the name search is a string, we’ll also check for additional author metadata in ‘site.data.authors`
Instance Method Summary collapse
-
#initialize(page: nil, site: nil) ⇒ AuthorDrop
constructor
Initialize a new AuthorDrop.
-
#name ⇒ Object
(also: #to_s)
AuthorDrop#to_s should return name, allowing the author drop to safely replace ‘page.author`, if necessary, and remain backwards compatible.
- #twitter ⇒ Object
Constructor Details
#initialize(page: nil, site: nil) ⇒ AuthorDrop
Initialize a new AuthorDrop
page - The page hash (e.g., Page#to_liquid) site - The Jekyll::Drops::SiteDrop
180 181 182 183 184 185 186 |
# File 'lib/starter_web/_plugins/seo/j1-seo-tags.rb', line 180 def initialize(page: nil, site: nil) raise ArgumentError unless page && site @mutations = {} @page = page @site = site end |
Instance Method Details
#name ⇒ Object Also known as: to_s
AuthorDrop#to_s should return name, allowing the author drop to safely replace ‘page.author`, if necessary, and remain backwards compatible
190 191 192 |
# File 'lib/starter_web/_plugins/seo/j1-seo-tags.rb', line 190 def name ["name"] end |
#twitter ⇒ Object
195 196 197 198 199 200 |
# File 'lib/starter_web/_plugins/seo/j1-seo-tags.rb', line 195 def twitter return @twitter if defined? @twitter twitter = ["twitter"] || ["name"] @twitter = twitter.is_a?(String) ? twitter.sub(%r!^@!, "") : nil end |