Move layout/sidebar into `frame.html.jinja2`
See original GitHub issueProblem Description
In my pdoc-powered site, I wished to combine elements of pdoc and non-pdoc content on the same pages. In order to do this, I had to set the ‘module’ variable, even though it didn’t make sense in this context. It is possible to work around, but somewhat awkward.
Proposal
Go through the code and find every place that module is used, and ensure that the code would work with a null object instead. This might perhaps be limited to the nav part of the template (leaving the main part of the template breaking if module isn’t an actual value, which kinda makes sense).
Alternatives
- I was able to work around this need by creating a dummy module object and passing that in to
template.render
. If there isn’t enough interest, we can just leave it at that. - One might also consider re-arranging the default template hierarchy so that there was a page type “above”
module.html.jinja2
that doesn’t require themodule
variable to be set, and have `module.html.jinja2’ (and ‘index.html.jinja2’) inherit from that. This would make sense, but it would probably also be a breaking change, so perhaps not a good idea.
Additional context
You can see the site I have created at https://projectdrawdown.github.io/solutions/. I want to have the nav on all pages, even those that aren’t module pages, and thus needed to do the workaround.
Also, I am willing to do this work, if it seems worthwhile.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (7 by maintainers)
Top GitHub Comments
I had the same issue @abubelinha – You probably define your own
{% block nav %}
. Inside that, you need to remove the outer level<nav>
element, which is now part of the frame template, and leave just the contents.Honestly I’d rather leave refactoring like that to you — I’m sure your sensitivity to fine feature details will be better than mine on this 😃