diff --git a/lib/jekyll-theme-cs50.rb b/lib/jekyll-theme-cs50.rb index 73d86ec..fe1680e 100644 --- a/lib/jekyll-theme-cs50.rb +++ b/lib/jekyll-theme-cs50.rb @@ -576,11 +576,15 @@ def parse_link current_link = @tree.children.select{ |element| [:a].include?(element.type) }.last unless current_link.nil? - # If inline link ends with .md - if match = current_link.attr["href"].match(/\A([^\s]*)\.md(\s*.*)\z/) - - # Rewrite as /, just as jekyll-relative-links does - current_link.attr["href"] = match.captures[0] + "/" + match.captures[1] + # If a relative link + if !current_link.attr["href"].start_with?("https://", "http://") + + # If link ends with .md + if match = current_link.attr["href"].match(/\A([^\s]*)\.md(\s*.*)\z/) + + # Rewrite as /, just as jekyll-relative-links does + current_link.attr["href"] = match.captures[0] + "/" + match.captures[1] + end end end end