Closed andjar closed 4 years ago
Could you give me an example of what you are doing currently?
To add the navigation bar itself, I added
{% set navigablePage = page_navigation(page.content ?? '', page.header.itemize ?? theme.itemize ?? false) %}
...
{% block header %}
<header role="banner">
{% include 'partials/header.html.twig' with {'page': page, 'navigablePage': navigablePage} %}
</header>
{% endblock %}
to tufte.html.twig and added
.page header{
width: 133.3%;
margin-left: -25%;
}
.page drawer-menu header{
margin-left: 0%;
width: 100%;
}
to tufte.min.css to stretch it across the whole page. And it seems to work fine, but the links in the drawer menu doesn't go anywhere. So I tried to edit this line in tufte.html.twig
{{ page.content|strip_html_tags(['h1'])|section_wrapper('section', ['h2', 'h3', 'h4', 'h5', 'h6']) }}
by changing page to navigablePage. To the drawer menu then works, but the sections aren't wrapped properly as the heading-tags are "hidden" inside <a name= ""></a>
and the layout breaks
The section_wrapper
-function is for internal compliance with how Tufte expects HTML to be structured. I have added heading-anchors and adapted the width-styling somewhat for the Tufte-template in v2.1.0-beta.3. This also means that a premade list of anchors to the headings is available as navigablePage.headings
in tufte.html.twig
.
Please update to this version by installing it manually. The theme is still locked to the 1.6, or stable, branch of Grav, and updating on the testing-channel via GPM will update Grav itself and other extensions.
It works perfectly, thank you very much!
Hi,
As some of the Tufte documents can get rather long, I tried to keep the header and navigation bar. But I was unable to make the drawer menu work as the headers in the tufte documents are rendered without anchor names, and I was unable to adapt the section_wrapper properly. Do you have any suggestions for how this can be achieved?