Class: Jekyll::PostUrl

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll/tags/post_url.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, post, tokens) ⇒ PostUrl

Returns a new instance of PostUrl.



16
17
18
19
20
# File 'lib/jekyll/tags/post_url.rb', line 16

def initialize(tag_name, post, tokens)
  super
  @orig_post = post.strip
  @post = PostComparer.new(@orig_post)
end

Instance Method Details

#render(context) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jekyll/tags/post_url.rb', line 22

def render(context)
  site = context.registers[:site]
  
  site.posts.each do |p|
    if p == @post
      return p.url
    end
  end

  puts "ERROR: post_url: \"#{@orig_post}\" could not be found"

  return "#"
end