[Docs] Version the stylesheet URL by its content - #62
Merged
Merged
Conversation
GitHub Pages serves assets/extra.css under the same URL whatever it contains, so a browser that cached an older copy keeps it and renders new markup without the styles that go with it: the User Guide cards showed as plain headings and lists. hooks.py now appends a hash of the stylesheet's content to its URL, so the URL changes whenever the styles do.
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.
Problems
assets/extra.cssis served under the same URL whatever it contains, and GitHub Pages lets browsers cache it. A browser holding an older copy renders new markup without its styles: after [Docs] Add a development guide and a Blog section, lay out the indexes as cards, and reorder the API and Benchmarks pages #61 the User Guide cards showed as plain headings and lists until a hard refresh.Changes
hooks.pyappends a hash of each local stylesheet's content to itsextra_cssURL inon_config, e.g.assets/extra.css?v=93090c7963, so the URL changes whenever the styles do. Entries that already carry a query or are not local files are left alone.CLAUDE.mdrecords that the hook versions the URL, so no one adds?v=by hand.mkdocs buildreports onlygriffe:warnings; the English and Chinese pages both link the versioned URL.pytestandruffpass.