Class: Jekyll::SeoTag::ImageDrop

Inherits:
Drops::Drop
  • Object
show all
Includes:
UrlHelper
Defined in:
lib/starter_web/_plugins/seo/j1-seo-tags.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)


550
551
552
553
554
555
556
# File 'lib/starter_web/_plugins/seo/j1-seo-tags.rb', line 550

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



561
562
563
# File 'lib/starter_web/_plugins/seo/j1-seo-tags.rb', line 561

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