Skip to content

Commit

Permalink
Caveat: this uses a private attribute, the next version of MkDocs wil…
Browse files Browse the repository at this point in the history
…l probably have something official instead
  • Loading branch information
oprypin committed Feb 3, 2024
1 parent c20358d commit ae4d1a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/.hooks/title_from_content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def on_page_content(
html, # noqa: ARG001
page,
**kwargs, # noqa: ARG001
):
if title := page._title_from_render: # noqa: SLF001
page.meta['title'] = title
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ watch:

hooks:
- docs/.hooks/plugin_register.py
- docs/.hooks/title_from_content.py

plugins:
# Enable for bug reports
Expand Down

0 comments on commit ae4d1a8

Please sign in to comment.