Skip to content

Commit

Permalink
Merge pull request #9 from XhmikosR/patch-2
Browse files Browse the repository at this point in the history
Fix Windows backslashes
  • Loading branch information
burkestar authored May 31, 2020
2 parents d8c0b8b + bde5b93 commit 0feec02
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mkdocs_redirects/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def on_files(self, files, config, **kwargs):
# Build a dict of known document pages to validate against later
self.doc_pages = {}
for page in files.documentation_pages(): # object type: mkdocs.structure.files.File
self.doc_pages[page.src_path] = page
self.doc_pages[page.src_path.replace('\\', '/')] = page

# Create HTML files for redirects after site dir has been built
def on_post_build(self, config, **kwargs):
Expand All @@ -115,9 +115,9 @@ def on_post_build(self, config, **kwargs):
site_url_path = urlparse(config.get('site_url')).path.rstrip('/')
if site_url_path:
# Take into account the site_url configuration, which could include a path
dest_path = site_url_path + '/' + self.doc_pages[page_new].dest_path
dest_path = site_url_path + '/' + self.doc_pages[page_new].dest_path.replace('\\', '/')
else:
dest_path = '/' + self.doc_pages[page_new].dest_path
dest_path = '/' + self.doc_pages[page_new].dest_path.replace('\\', '/')

# If use_directory_urls is set, redirect to the directory, not the HTML file
if use_directory_urls:
Expand Down

0 comments on commit 0feec02

Please sign in to comment.