Skip to content

Commit bde5b93

Browse files
committed
Fix Windows backslashes
1 parent b2730b2 commit bde5b93

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mkdocs_redirects/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def on_files(self, files, config, **kwargs):
9595
# Build a dict of known document pages to validate against later
9696
self.doc_pages = {}
9797
for page in files.documentation_pages(): # object type: mkdocs.structure.files.File
98-
self.doc_pages[page.src_path] = page
98+
self.doc_pages[page.src_path.replace('\\', '/')] = page
9999

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

122122
# If use_directory_urls is set, redirect to the directory, not the HTML file
123123
if use_directory_urls:

0 commit comments

Comments
 (0)