Some of my clients need to add what I would call "ad-hoc" pages to their sites. As many have pointed out, this is (a) somewhat contrary to the spirit/concept of EE channels and (b) when necessary, arguably best handled by the Structure module.
On a new project I'm considering skipping Structure and incorporating two channels: one called Pages and another called Sub-Pages. Both channels would have generic {main_content}
and {sidebar_content}
fields, but Sub Pages would have a {page_assignment}
relationship field to subordinate the page to an existing Page.
How would you output a dynamic navigation of titles/links with unordered lists, adding active classes as appropriate? To save space, Sub Pages belonging to a Page should only be listed when that Page or sibling Sub Pages are active. In other words, you have to "click into" a Page to see its Sub Pages.
So if I'm on the Products landing page or the Products 1 sub page, the nav should look like:
Products
Product 1
Product 2
Product 3
About the Company
Services
But if I'm on the About the Company landing page or the Our History sub page, it should look like:
Products
About the Company
About Our Team
Our History
Services