.Render is broken in v147.0

In order to group some layouts together for different sections with different content adaptors, I created some folders within the _default folder with these layouts that were called conditionally using .Render in the list and single templates. But the new template system breaks these layouts when they are moved out of the _default folder. No error is thrown, just empty content pages.

I was avoiding using partials, but if this is a breaking change and not a bug, I will gladly move these layouts to partials.

Test site GitHub - tycobrah/foo. Posts Foo 1 and Foo 2 are empty.

Please don’t.

Short story: Move single/foo.html up to top level layouts and adjust the name in the lookup.

Longer story:

  • The path below /layouts (that’s not the underscore variants _partials, _shortcodes or _markup) has a consistent and only one meaning (with some special handling for when type is set in front matter): It matches the Page path.
  • So when we look for a template for .Render "foo", we find the best matching layout for the given layout foo and the distance from the layout up to the Page’s path as two of the criteria (closer is better).

You coud argue that this is a breaking change, and you’re right, but:

  1. I have never seen the above case before (I’m pretty sure the docs for Render says “layout name”).
  2. It’s not easiliy fixable without breaking the new model (which I think is much better than the old one)
4 Likes

I actually have several of these layouts (12 and 12 output JSON formats for each) for list and single pages. I was grouping them this way to avoid cluttering the layouts folder, but I will look for a better naming system and move them to the base of layouts. For now, I moved them to partials to get my site back up again.

Thanks for the clarification.

1 Like