-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Theme files override docs_dir files on Windows #1876
Comments
At first I was confused by this because we have a test (added in f8ac3c7) which passes on all supported systems (including Windows). But then I realized that the test does not include any nested directories. All paths tested do not include any slashes (for example, This is my best guess without a way to test it. To make matters worse, our Windows CI tests are broken for reasons I don't understand, so I can't rely on them for testing. |
Normalizing the path before checking the files in for path in env.list_templates(filter_func=filter):
# Theme files do not override docs_dir files
path = os.path.normpath(path)
if path not in self:
for dir in config['theme'].dirs:
# Find the first theme dir which contains path
if os.path.isfile(os.path.join(dir, path)):
self.append(File(path, dir, config['site_dir'], config['use_directory_urls']))
break (Line 3 was added.) Didn't test it on Unix, but should work there as well. |
That is exactly what I suspected the fix would be. Thanks for testing it. Feel free to create a PR. |
As investigated and discussed in squidfunk/mkdocs-material#1282, custom files in docs_dir are overriden by theme files.
For example, if you use the default MkDocs theme and create a custom
favicon.ico
indocs/img
, the custom icon does not appear in the output. It is overwritten by the theme's own favicon.The issue was already brought up in #1671 and fixed by #1672.
However, the fix (#1672) only works on Unix systems (including Mac). It does not work on Windows.
Windows handles path names differently, so I suppose the issue must be caused by that. See especially the use of
os.path
infiles.py
(f8ac3c7ee).I had a similar issue in mkdocs-exclude, see here: apenwarr/mkdocs-exclude#2
The text was updated successfully, but these errors were encountered: