✨ relative_path filter
This commit is contained in:
10
_plugins/relative_path.rb
Normal file
10
_plugins/relative_path.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
module Jekyll
|
||||
module RelativePath
|
||||
def relative_path(url)
|
||||
page_url = @context.registers[:page]['url']
|
||||
Pathname(url).relative_path_from(Pathname(page_url)).to_s
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::RelativePath)
|
||||
Reference in New Issue
Block a user