Class: Jekyll::LastModifiedAt::Tag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-last-modified-at/tag.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, format, tokens) ⇒ Tag

Returns a new instance of Tag.



6
7
8
9
# File 'lib/jekyll-last-modified-at/tag.rb', line 6

def initialize(tag_name, format, tokens)
  super
  @format = format.empty? ? nil : format.strip
end

Instance Method Details

#render(context) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/jekyll-last-modified-at/tag.rb', line 11

def render(context)
  site = context.registers[:site]
  format = @format || site.config.dig("last-modified-at", "date-format")
  article_file = context.environments.first["page"]["path"]
  Determinator.new(site.source, article_file, format)
    .formatted_last_modified_date
end