mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-11 05:28:57 +00:00
17 lines
400 B
Ruby
17 lines
400 B
Ruby
module Jekyll
|
|
class LinkableTitleTag < Liquid::Tag
|
|
def initialize(tag_name, text, token)
|
|
super
|
|
@title = text
|
|
end
|
|
|
|
def render(context)
|
|
slug = @title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
|
|
|
|
"<a class='title-link' name='#{slug}' href='\##{slug}'></a> #{@title}"
|
|
end
|
|
end
|
|
end
|
|
|
|
Liquid::Template.register_tag('linkable_title', Jekyll::LinkableTitleTag)
|