Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
galaxyproject
GitHub Repository: galaxyproject/training-material
Path: blob/main/_plugins/link.rb
1677 views
1
# frozen_string_literal: true
2
3
module Jekyll
4
module Tags
5
6
# Replaces the built in link tag temporarily
7
class CustomLinkTag < Liquid::Tag
8
def initialize(tag_name, text, tokens)
9
super
10
@text = text.strip
11
end
12
13
def render(_context)
14
# This is a workaround for https://github.com/jekyll/jekyll/issues/9179
15
# We should remove it when 9179 is solved.
16
#
17
# Note that this does NOT support news posts with a date in the URL.
18
"/training-material/#{@text.gsub(/\.md/, '.html')}"
19
end
20
end
21
end
22
end
23
24
Liquid::Template.register_tag('link', Jekyll::Tags::CustomLinkTag)
25
26