diff --git a/lib/jekyll/polyglot/patches/jekyll/site.rb b/lib/jekyll/polyglot/patches/jekyll/site.rb index a2721c610..de7576723 100644 --- a/lib/jekyll/polyglot/patches/jekyll/site.rb +++ b/lib/jekyll/polyglot/patches/jekyll/site.rb @@ -213,20 +213,23 @@ def absolute_url_regex(url, disabled = false) def relativize_urls(doc, regex) return if doc.output.nil? - - doc.output.gsub(regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"') + modified_output = doc.output.dup + modified_output.gsub!(regex, "href=\"#{@baseurl}/#{@active_lang}/" + '\1"') + doc.output = modified_output end def relativize_absolute_urls(doc, regex, url) return if doc.output.nil? - - doc.output.gsub(regex, "href=\"#{url}#{@baseurl}/#{@active_lang}/" + '\1"') + modified_output = doc.output.dup + modified_output.gsub!(regex, "href=\"#{url}#{@baseurl}/#{@active_lang}/" + '\1"') + doc.output = modified_output end def correct_nonrelativized_absolute_urls(doc, regex, url) return if doc.output.nil? - - doc.output.gsub(regex, "href=\"#{url}#{@baseurl}/" + '\1"') + modified_output = doc.output.dup + modified_output.gsub!(regex, "href=\"#{url}#{@baseurl}/" + '\1"') + doc.output = modified_output end def correct_nonrelativized_urls(doc, regex) @@ -234,7 +237,6 @@ def correct_nonrelativized_urls(doc, regex) modified_output = doc.output.dup modified_output.gsub!(regex, "href=\"#{@baseurl}/" + '\1"') doc.output = modified_output - # doc.output.gsub(regex, "href=\"#{@baseurl}/" + '\1"') end end end