Sage cannot find correct template for top-level pages

I’ve just deployed a Sage template using Acorn 2.1.2, using a default WordPress install (so themes are at the root wp-content/themes directory).

On my local setup (using Bedrock) all templates are correctly loaded. On the remote all the top-level pages are rendered using the index.blade.php template instead of the expected page.blade.php (or any custom defined page template in WordPress). Pages with a parent all load correctly and have the page template applied.

Does anybody how to debug this? I’ve been drilling down into the Roots vendor package and filterTemplateHierarchy in vendor/roots/acorn/src/Roots/Acorn/Sage/Concerns/FilterTemplates.php returns an array of:

[
  'home.php',
  'index.php'
]

instead of:

[
  'page-{title}.php',
  'page-{id}.php',
  'page.php'
]

But I’m unsure how to proceed further.

This turned out to be a rewrite issue. I had defined a custom taxonomy with a reserved name (year), which made URL rewriting unreliable. Renaming the taxonomy to period fixed the loading issue.

2 Likes