Skip to content
Discussion options

You must be logged in to vote

I have also encountered this problem. According to Nunjucks' template inheritance blocks are only supported in templates that extend an ancestor and lack support for your use case of using them in partials.

Maybe, a workaround could be to replace the block with a conditional that checks for the current page's url or to set a flag in your frontmatter? That could look like this:

<header>
  <div class="nav-container">
    <nav class="header-nav">
      <a href="shop.html" class="shop-link">Shop</a>
      <a href="gallery.html">Gallery</a>
      <a href="/exhibitions">Exhibitions</a>
    </nav>
    {% if page.url == "/the/page/url" or includeCartNav %}
    {# with `includeCartNav` being set i…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@alecgregory
Comment options

Answer selected by alecgregory
Comment options

You must be logged in to vote
1 reply
@alecgregory
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants