1

I'm trying to create parent/child Single sections without using Structures. So in other words, create a Single section and assign it a parent Single section. Is this possible?

  • 2
    Why? The short answer is "no, that's not possible"... because that's what Structures are for. – Lindsey D Feb 9 '16 at 4:19
  • How would you use Structures for like child pages that are all like single one-off pages that each have different template/layout? – biko Feb 10 '16 at 8:37
  • Just added an answer, which I think addresses the heart of the issue. – Lindsey D Feb 10 '16 at 23:12
4

Take a look into Entry Types, I'm pretty sure that's a much better way to handle what you're trying to achieve:

https://craftcms.com/features/entry-types

So you'd have a Structure section (let's call it "Pages"), and within that Structure you have multiple Entry Types. You could have a distinct Entry Type for each page type ("About", "Contact", etc).

Once you've got that, it's easy to serve up different templates for each Entry Type:

https://craftcms.com/support/entry-type-templates

| improve this answer | |
  • Thanks for this. This seems the most logical and least hacky solution! – biko Feb 12 '16 at 6:58
3

Ignoring the obvious "use a Structure" answer, I suppose you could fake a "hierarchy" by placing a child and parent entry field on each of your Single sections and manually assigning entries as relationships.

Then your Twig template could would just be checking those fields and building the family tree based on the relationships.

| improve this answer | |
  • That's an idea. Can you share how you would use Structures for like child pages that are all like single one-off pages that each have different template/layout? (same comment I posted above) – biko Feb 10 '16 at 8:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.