Class: Jekyll::SeoTag::ImageDrop

Inherits:
Drops::Drop
  • Object
show all
Includes:
UrlHelper
Defined in:
lib/jekyll-seo-tag/image_drop.rb

Overview

A drop representing the page image The image path will be pulled from:

  1. The ‘image` key if it’s a string

  2. The ‘image.path` key if it’s a hash

  3. The ‘image.facebook` key

  4. The ‘image.twitter` key

Instance Method Summary collapse

Constructor Details

#initialize(page: nil, context: nil) ⇒ ImageDrop

Initialize a new ImageDrop

page - The page hash (e.g., Page#to_liquid) context - the Liquid::Context

Raises:

  • (ArgumentError)


19
20
21
22
23
24
# File 'lib/jekyll-seo-tag/image_drop.rb', line 19

def initialize(page: nil, context: nil)
  raise ArgumentError unless page && context
  @mutations = {}
  @page = page
  @context = context
end

Instance Method Details

#pathObject Also known as: to_s

Called path for backwards compatability, this is really the escaped, absolute URL representing the page’s image Returns nil if no image path can be determined



29
30
31
# File 'lib/jekyll-seo-tag/image_drop.rb', line 29

def path
  @path ||= filters.uri_escape(absolute_url) if absolute_url
end