mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-06 03:01:43 -04:00
filter relative_url should keep absolute urls with scheme/authority (#6490)
Merge pull request 6490
This commit is contained in:
committed by
jekyllbot
parent
beed5513e4
commit
a66c4780cc
@@ -20,13 +20,16 @@ module Jekyll
|
||||
).normalize.to_s
|
||||
end
|
||||
|
||||
# Produces a URL relative to the domain root based on site.baseurl.
|
||||
# Produces a URL relative to the domain root based on site.baseurl
|
||||
# unless it is already an absolute url with an authority (host).
|
||||
#
|
||||
# input - the URL to make relative to the domain root
|
||||
#
|
||||
# Returns a URL relative to the domain root as a String.
|
||||
def relative_url(input)
|
||||
return if input.nil?
|
||||
return input if Addressable::URI.parse(input.to_s).absolute?
|
||||
|
||||
parts = [sanitized_baseurl, input]
|
||||
Addressable::URI.parse(
|
||||
parts.compact.map { |part| ensure_leading_slash(part.to_s) }.join
|
||||
|
||||
Reference in New Issue
Block a user