Content layout inheritance from single.html - Or alternate best practices

If I have a baseof.html defined.
Then the single and list, respectively defined.
Then I have the content layouts as necessary.
All is in order.

Now, could we say that within a content directory, each page within has different bits and bobs attached to it, maybe a Call To Action here, or another section there, or newsletter subscription.
I think this is a somewhat normal use-case.

I would define each of this in a resuse concept. I.e. I’d have the newsletter subscription defined as a partial so I can reuse anywhere I need. “Ah, we have a new X page, and the editor wants a contribute and a sidebar, plop, plop”.

So currently my options are:

  1. Include that partial with a shortcode or as a shortcode within the markdown of a page that needs that partial.
  2. Put an if or where statement in the layout template which reads, possibly a front matter variable, and then pulls the partial and generates it (essentially a toggle).
  3. Make many individual layouts (which seems would not really be reuse as I’m copy pasting the layout and updating would be a nightmare)—This possibly could be wrong as I would assume their would be an inheritance system in the hierarchy of layouts, but I’ve not been able to find examples or documentation of it as of yet.
  • I feel I am well and trully missing something.

Could I put upon the community to assist me in seeing what I am missing or what concept or nomenclature I’ve not grasped?

Thank you for everyone’s time.

You might have a look at:

1 Like

Yes, that’s exactly what I wasn’t tracking with (and the connecting misunderstood concepts I had with the look-up tables).

This does resolve.

This is 2 for 2 now. I have to say the oversight is much appreciated Mr. Mooring.

1 Like

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