-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Block override doesnt work #1142
Comments
The search box should be in the |
Yes, that what i did , here is my main.html in the custom_theme to translate some terms in french (footer override is OK, but not the search_button and the next_prev) :
|
Groan. I just did a quick search and the first result indicates this is not possible. Apparently, when I was adding the blocks to the templates, I never tested whether this works for the "included" templates. There are some possible workarounds, but those require edits to the @fmalinge there is one other workaround you could try. Copy |
OK, but it's a shame because override template block was a good solution (we can update mkdocs without losing its code). Is what i can create a custom_nav that would be an extend of nav (extend nav.html) |
@waylan According to this PR pallets/jinja#84 it seems blocks inside included templates can be overriden |
Yes and in pallets/jinja#243 they reverted the change removing support as it apparently broke stuff. So unless you run a custom modified version of Jinja, this isn't going to work, which is disappointing to say the least. |
Just fell into the same trap. The mkdocs-docs mentions this, but just in passing:
http://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks However the list of block names which follows includes a few which are not (easily) overridable, such as |
This is extremely unclear in the docs... I don't think the docs should be saying that |
@waylan Would you consider a PR that does away with any include files that contain blocks and just merge that content directly into base.html? The way it stands, 5 out the 14 documented overridable template blocks simply don't work at all, and I doubt Jinja is ever going to support this. |
I'm of two minds about this. On the one hand, making the changes would give us the intended/desired behavior. On the other hand, the existing file structure of the themes has existed long before we added blocks and there are potentially many existing users who are already providing their own overriding template files (such as Something that we need to remember (and perhaps the docs could be more clear about) is that MkDocs may provide support for a feature, but that does not mean that every theme does. This is one of those features where MkDocs provides the mechanisms, but support is entirely dependent on the theme making use of that mechanism. Ideally the "default" theme would support all features, but that shouldn't be assumed about all themes in general. If that all sounds indecisive, that's because I'm not sure how I want to proceed. If someone could submit a PR which addressed all my concerns, that would be great. But I doubt that's possible. So do we support the documented feature that had never worked, or the undocumented feature that has always worked? |
Good point about breaking users who may have overridden an entire include. (That was going to be my work-around, so I would have broken myself!) Another possible solution is to create a new out-of-the-box theme, like "mkdocs2" (or whatever you come up with that's bound to be better). Folks could "upgrade" to that if and when they choose, and that theme could support all 14 blocks by flattening everything to base.html or whatever. But then again, I'm not sure if supporting another theme indefinitely just for this is better than just taking a breaking change for 1.0. I think the docs are clear that not all themes necessarily support all features. The bigger problem as I see it is they say "The MkDocs and ReadTheDocs themes provide the following blocks: ...", which is simply not correct. Anyway, happy to help if you want. I was really excited to find MkDocs and I'm loving it so far. Thank you. |
Fixes mkdocs#1142 for mkdocs theme. RTD theme will be addressed with mkdocs#588.
As mentionned here: mkdocs#1142 (comment) I just correct the name in the documentation
As mentionned here: #1142 (comment) I just correct the name in the documentation
Can the docs be updated to reflect this known issue? I followed the docs step-by-step only to end up spending an hour searching the internet for reasons why |
Hi,
I ve created a custom theme to make small modification to the mkdocs theme.
I ve created a main.html (witch extend the base) 馃憤
it override footer block : OK
But I cant override next_prev block (to translate the search box)
Is it because next_prev is include in the nav.html ?
Thanks
Fred
The text was updated successfully, but these errors were encountered: