Skip to content

add on_page_template event #3786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

carlocastoldi
Copy link

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.

@tomchristie
Copy link
Member

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

@carlocastoldi
Copy link
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
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