Repository navigation
Fix mkdocs serve and Material on multi-language sites - #153
Merged
Merged
Conversation
The faster rebuilds of `mkdocs serve` remove the files that the previous build wrote and this one didn't. Each language counted as a build of its own, so building Chinese removed the English pages, and the next rebuild the other way round: the default language answered 404. The languages of a site now count as one build of the site directory: stale files are removed once all of them are built.
Material reads its language from `theme.language`, not `theme.locale`, so every language of a site built with it said `<html lang="en">` and showed the English interface. `theme.language` is now set the same way as `theme.locale`: to the language code, unless the language or (for the default language) mkdocs.yml sets it.
mkdocs serve rebuilds a multi-language sitemkdocs serve and Material on multi-language sites
Contributor
…-0swvxa # Conflicts: # docs/about/release-notes.md
Member
Author
|
The CodSpeed check reports a -17.8% regression in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two bugs I found while testing the new
languagessetting (#146) end to end, one commit each. Both are in 1.11.0rc1. The release notes are under 1.11.0 (unreleased).mkdocs serveanswered 404 for every page of the default language. The faster rebuilds from #145 remove the files that the previous build wrote and the current one didn't. Each language is its own build, so buildingzhremoved the English pages (and the next rebuild did the reverse).mkdocs buildwasn't affected. The languages of a site now count as one build of the site directory:SiteOutput.start_languages()/end_languages()wrap them, and stale files are removed once every language is built. A page deleted from one language is still removed on the next rebuild.Material for MkDocs showed every language in English (
<html lang="en">, English search box and labels). Material readstheme.language, nottheme.locale. Withtheme.name: material,theme.languageis now set liketheme.locale: to the language code, unless the language or (for the default language)mkdocs.ymlsets it. The Multi-language Sites page says so.Tests:
output_tests.py(they fail without the fix) andlanguages_tests.py. The full suite passes.docs/anddocs-zh/, and a removed page went away.--strict. The Chinese site haslang=zhand the Chinese UI.