2

I’m trying to find a way to ‘group’ pages in a structure, where that group page has no function other than to visually organise the entries in the structure, and does not need to be part of the url structure.. eg:

- Major Campaigns 
   type: landingPageGroup
   slug: major-campaigns

    - Moving Office
       type: landingPage
       slug: moving-office
       uri: /moving-office

        - Your Moving Checklist 
           type: landingPage
           slug: your-moving-checklist
           uri: /moving-office/your-moving-checklist

- Major Events
   type: landingPageGroup
   slug: major-events

    - Conference 2016
       type: landingPage
       slug: conference-2016 
       uri: /conference-2016

        - Agenda 
           type: landingPage
           slug: agenda
           uri: /conference-2016/agenda

If I set the Entry URL Format to:

Top level: {% if entry.type != 'landingPageGroup' %}{slug}{% endif %}

Nested: {% if object.parent.type != 'landingPageGroup' %}{parent.uri}{% endif %}/{slug}

...the URLs look correct in the entries listing, but it will throw a 404 when you try to access them... is there anyway I can get around this with some custom routing maybe?

1 Answer 1

2

I don't know of good, non-hacky way to do what you're doing. Every entry in a structure should have some meaning otherwise you're going to fight the system.

Is there a reason why those top level landingPageGroups are just "vestigial" and serve no purpose? That would make them good candidates to break into separate sections. So Major Campaigns would be a new structure section, Major Events would be another new structure section, etc.

You could probably hack your web server to rewrite slugs so that /major-campaigns/moving-office becomes /moving-office but for every section you add, that becomes a nightmare.

Even if you think you'll use one template across the board, it's inevitable that at some point you'll be using different templates for each "section" as well. I don't know your content strategy but if you only use one section, your entry types will likely multiply too.

1
  • Yeah, you have a point, I think I'm probably trying to push it too far... and you're right - they could well be different sections, but they are all such similar content that I'd rather not divide them up so much. Will just have to live with it for now, and make use of categories in the listing or something. Cheers! Nov 25, 2016 at 6:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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