Class: Jekyll::Gallery::SeoImage
- Inherits:
-
Object
- Object
- Jekyll::Gallery::SeoImage
- Defined in:
- lib/jekyll/gallery/seo.rb
Overview
Expand the image:cover paths to accomplish the Jekyll-Gallery filesystem standards and return a path compatible with the Jekyll-Seo-Tag plugin.
Class Method Summary collapse
Class Method Details
.setup ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jekyll/gallery/seo.rb', line 11 def self.setup Jekyll::Hooks.register :documents, :pre_render do |document| image = document["image"] collection = document.type update_frontmatter(image, collection) end end |
.update_frontmatter(image, collection) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/jekyll/gallery/seo.rb', line 20 def self.update_frontmatter(image, collection) return unless image.is_a? Hash return if image["cover"].nil? file = Helper.(image["cover"], collection) raise MissingFile, file unless File.exist?(file) image["path"] = Helper.(image["cover"], collection) end |