Cascade isn't hitting all topics

I’m trying to target a bunch of pages inside subfolders using cascade but not all of the pages use the template - even in the same folder. And I can’t see a pattern in the ones which fail.

I’ve created a repo to show it - GitHub - honzik20/hdeet-cascade-bug: hdeet-cascade-bug

I’ve added a cascade to content/en/hdeet_reference/_index.md specifying the use of the “reference” template.

If I build the site, a page like public/hdeet_reference/calculated_data/multicycleresults/cycle.html uses the templates in layouts/partials/reference - the word HELLO appears before the title and there’s a table in the content.

But public/hdeet_reference/calculated_data/multicycleresults/cycleendtime.html in the same folder doesn’t use it.

I’m on v 0.102.3. Can anyone help?

Your test site doesn’t build.

Sorry about that - I’ve added the Docsy submodule.

  1. Do git clone --recurse-submodules https://github.com/honzik20/hdeet-cascade-bug
  2. npm install postcss-cli
  3. cd themes/docsy && npm install

It should run then.

Your test site still doesn’t build.

Error: Error building site: TOCSS: failed to transform “scss/main.scss” (text/x-scss): “/home/jmooring/temp/hdeet-cascade-bug/themes/docsy/assets/scss/main.scss:6:1”: File to import not found or unreadable: …/vendor/bootstrap/scss/bootstrap.

I commented out the call to the head-css partial to bypass the error and continue troubleshooting.

The problem is intermittent, and is caused by conflicting cascade directives.

content/en/hdeet_reference/_index.md

  - type: reference
    _target:
      kind: page

content/en/_index.md

cascade:
  - type: docs
    _target:
      path: /**
      kind: section
  - type: docs
    _target:
      path: /**
      kind: page
  - type: blog
    _target:
      path: /blog/**

So in one place you’re setting the type to reference, and in another your’re setting the type to docs. Due to concurrency (rendering pages in parallel) you have no control over which page will be rendered first… hence the intermittent nature of the behavior.

Remove the conflicting directives.

You might want to move them all to your site configuration where you can see them all in one place.

2 Likes

Thanks @jmooring. So I can move the entire cascade keyword into config.yml? I did not know that.

Yes. You do something like this in your site configuration:

cascade:
  - type: reference
    _target:
      path: /hdeet_reference/**
  - type: news
    _target:
      path: /hdeet_news**

Learn about Glob patterns here:
https://github.com/gobwas/glob#example

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.