Skip to content

add on_page_template event#3786

Open
carlocastoldi wants to merge 2 commits intomkdocs:masterfrom
carlocastoldi:on-template
Open

add on_page_template event#3786
carlocastoldi wants to merge 2 commits intomkdocs:masterfrom
carlocastoldi:on-template

Conversation

@carlocastoldi
Copy link
Copy Markdown

By adding this new event, i'd like to allow plugins to change template based on the page being built.

An example of usage can be seen in this in-development plugin: mkdocs_multi_theme_plugin

Before resorting to this upstream change, i have considered using other events (e.g. on_env), but I am afraid none allow per-page editing of the templates from the ground up.

@lovelydinosaur
Copy link
Copy Markdown
Member

Heya, is there a discussion or issue associated with this pull request?

@carlocastoldi
Copy link
Copy Markdown
Author

no, there is no associated issue to my knowledge.

Due to my requirements, i needed to have some pages following a theme, while others using another theme. I tried to only build a plugin, however I soon understood that the best solution required me to modify mkdocs itself.
While, according to my needs, I think I could live just with my small fork of mkdocs, I think this new hook could also be useful to others. Hence why i opened this pull request!

@carlocastoldi
Copy link
Copy Markdown
Author

fyi, there was a brief discussion associated to something related to this topic: #3645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants