diff options
author | Achilleas Pipinellis <axil@gitlab.com> | 2019-03-13 22:56:42 +0300 |
---|---|---|
committer | Achilleas Pipinellis <axil@gitlab.com> | 2019-03-14 12:51:06 +0300 |
commit | 9d34353bf2da673adb843eac7443a3670243c4b8 (patch) | |
tree | 70d1d76651adfcd1eedf85dbeed78c8759b70b1e /Rules | |
parent | c8dbfbfb002904a5a9b25b5370520f8ba18658f2 (diff) |
Fix broken redirects
If there's a redirect_to defined, take it into account.
Diffstat (limited to 'Rules')
-rw-r--r-- | Rules | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -17,9 +17,13 @@ preprocess do item[:redirect_to] = item[:redirect_to].gsub!(/\.md/, '.html') end else - # If the provided relative URL is in Markdown, correct it to HTML. - unless item[:redirect_to].to_s.match(/.html$/) - item[:redirect_to] = item[:redirect_to].gsub!(/\.md/, '.html') + # If the provided path is in Markdown + if item[:redirect_to].to_s.match(/.md/) + # If it's not a full URL + unless item[:redirect_to].to_s.match(/^http/) + # Correct it to HTML + item[:redirect_to] = item[:redirect_to].gsub!(/\.md/, '.html') + end end end |