summaryrefslogtreecommitdiffstats
path: root/blog/_plugins/page_title.rb
blob: 3c835fdcfb07603736ecffb09dce99921889622f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require "facets/kernel/silence"

module Jekyll
  class PageTitleTag < Liquid::Tag
    def initialize(tag_name, text, tokens)
      super
      @key = text
    end

    def render(context)
      text = silently do
        t = Jekyll::LocalizeTag.parse('t', @key, '', {})
        t.render(context)
      end
      text || context[@key]
    end
  end
end

Liquid::Template.register_tag('page_title', Jekyll::PageTitleTag)