Skip to content

Instantly share code, notes, and snippets.

View ci-ryan-garcia's full-sized avatar

Ryan Garcia ci-ryan-garcia

View GitHub Profile
@ci-ryan-garcia
ci-ryan-garcia / relative.rb
Created October 3, 2017 18:39
Jekyll Plugin for Relative Links [UPDATED]
class Jekyll::Page
def relative
length = url.split("/").length
if (length > 0)
length = length - 1
("../" * length)[0...-1]
end
end
@ci-ryan-garcia
ci-ryan-garcia / relative.rb
Created September 28, 2017 21:54
Jekyll Plugin for Relative Links
class Jekyll::Page
def relative
("../" * (url.split("/").length-1))[1...-1]
end
def to_liquid(attrs = ATTRIBUTES_FOR_LIQUID)
super(attrs + %w[
relative
])