Closed kratsg closed 1 year ago
Further info: I am using basically the same script in oprypin/mkdocs-gen-files!2 for generating the SUMMARY.md
. This is used in mkdocstrings and they have the same issue as seen on this line: https://github.com/mkdocstrings/python/blob/273dbb6f3cc5efd28b37586892c80c207ab92a80/sitemap.xml#L44 /cc @pawamoy
I found a usable workaround. Because I suspected mkdocs
is picking up any md
files and trying to use that, I went ahead and changed the generating script to output a txt
file instead:
with mkdocs_gen_files.open("reference/SUMMARY.txt", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
and updated the literate-nav
plugin to point at this text file:
literate-nav:
nav_file: SUMMARY.txt
and now linkchecker has no error, and the sitemap does not include this SUMMARY.txt
(and it shouldn't).
Hey @kratsg, thanks for the ping. I'll probably start using SUMMARY.txt
as well then :rocket:
This will be fixed in MkDocs. But not released yet.
https://github.com/mkdocs/mkdocs/commit/07a297b3b4de4a1b49469b1497ee34039b9f38fa
Note: I'm always using
mkdocs build --no-directory-urls
to build the docs.I'm using the
gen-files
project to generate aSUMMARY.md
file for use withliterate-nav
. I generate the followingSUMMARY.md
however, running
linkchecker
over the sitemap gives me an error because there is an invalid URL added:however, if I edit the
mkdocs.yml
configuration to something nonsensical for thenav_file
and letliteral-nav
handle subdirectory for me...then the sitemap around this point looks like:
which tells me that the
SUMMARY.md
file is getting included asNone
in the sitemap! I'm not entirely sure how to fix this. Oddly, if I edit themkdocs.yml
to include a link to theSUMMARY.md
directly like so:then the
None
entry goes away! It seemsmkdocs
might be getting a little confused, orliterate-nav
needs to do a little extra work to either hide or addSUMMARY.md
into thenav
correctly.