Class: JekyllIncludeRelativeWithFrontmatter

Inherits:
JekyllIncludeWithFrontmatter show all
Defined in:
lib/jekyll-include-with-frontmatter.rb

Overview

Include relative to the source file. Blatantly stolen from Jekyll itself.

Constant Summary

Constants inherited from JekyllIncludeWithFrontmatter

JekyllIncludeWithFrontmatter::VERSION

Instance Method Summary collapse

Methods inherited from JekyllIncludeWithFrontmatter

#load_cached_partial, #render

Instance Method Details

#page_path(context) ⇒ Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/jekyll-include-with-frontmatter.rb', line 70

def page_path(context)
  if context.registers[:page].nil?
    context.registers[:site].source
  else
    site = context.registers[:site]
    page_payload  = context.registers[:page]
    resource_path = \
      if page_payload['collection'].nil?
        page_payload['path']
      else
        File.join(site.config['collections_dir'], page_payload['path'])
      end
    site.in_source_dir File.dirname(resource_path)
  end
end

#tag_includes_dirs(context) ⇒ Object



66
67
68
# File 'lib/jekyll-include-with-frontmatter.rb', line 66

def tag_includes_dirs(context)
  Array(page_path(context)).freeze
end