Class: Octopress::Ink::Tags::FeedUpdatedTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/octopress-ink/tags/feed_updated_tag.rb

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/octopress-ink/tags/feed_updated_tag.rb', line 5

def render(context)
  feed = context['page.feed_type']
  site = context['site']

  if feed == 'category'
    posts = site['categories'][context['page.category']]
  else
    posts = site[feed] || site['posts']
  end

  if posts && !posts.empty?
    post = posts.sort_by do |p|
      p.data['date_updated'] || p.date
    end.last

    post.data['date_updated_xml'] || post.data['date_xml']
  end
end