2

Coming from the EE world, when I need a hierarchical site structure along with sections that have channel-type content, I use the Structure add-on for EE. Events, for example, go in a listing channel.

Events

In Craft, while there is far more flexibility among the three section types: structure, channel, and single, there is no facility to create something akin to Structure for EE's listing channel.

Here's what I did instead. I created one master section of the structure type, and a whole bunch of different entry types.

Master structure

Each landing page, for example, Staff, calls a template that aggregates content from a channel (which is distinct from the master section). This keeps content neatly segregated - I don't want items that are listings (news, events, staff, etc.) clogging up the master section - it would end up with hundreds of entries over time.

Here's the staff channel:

Staff channel

So the staff landing page, part of the master section just calls all the entries in the staff channel, and each entry links to a detail page.

{% for entry in craft.entries.section('staff') %}
  <a href="/about/staff/{slug}">{{ entry.title }}</a>
{% endfor %}

Overall, this method works very well. However, creating navigation is messy. Why? In order to load the staff detail page, I have to link to entries and their template which lie outside the master section, so I can't navigation or create breadcrumbs with Craft's {% nav %} tag or a for loop. Also, I have to hard code the full path to the staff detail template, which includes its parents.

Staff section

My questions:

  • How are others solving this problem?
  • Is there a better way to make the staff detail entry url format more dynamic, in case the client decides to move the staff parent page elsewhere? Currently, if they move it out of about/staff, the staff detail urls are no longer correct.
2

0

Your Answer

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

Browse other questions tagged or ask your own question.