Class: JekyllGroup::PostGroupTag

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

Instance Method Summary collapse

Instance Method Details

#render(context) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jekyll-group/tag.rb', line 3

def render(context)
  page = context["page"]
  group = page["group"]

  return "" unless group

  liquid = "    <h3>Part of the {{ page.group.slug }} series</h3>\n    <ol>\n    {% for post in page.group.posts %}\n      {% if post.id == page.id %}\n        <li>{{ post.title }}</li>\n      {% else %}\n        <li><a href=\"{{ post.url | absolute_url }}\">{{ post.title }}</a></li>\n      {% endif %}\n    {% endfor %}\n    </ol>\n  EOL\n\n  partial = Liquid::Template.parse(liquid)\n  context.stack do\n    partial.render(context)\n  end\nend\n"