3

If I have a section called "news" with section type "channel" with entries having their own URLs, what is best practice for creating an index for when people site.com/news?

Do I just create an index file in 'template/news' or should I create a route?

EDIT: Did some more digging! Looks like some users have recommended using Structure to create parent level pages. Is this an ideal method?

1 Answer 1

3

If you are using a Structure to manage your site hierarchy, and the news index page naturally falls in that hierarchy, then yes, this can work well. Make an entry type for the index page, and in your template (which is the same for all the entry types),

{% include ['_page/'~entry.type, '_page/_default'] %}

(So if you haven't defined a template for this entry type you will use the _page/_default.html template instead of getting an error).

I think it is a good idea to use an entry for the index page (rather than just an index template) because there is very likely to be some content on that page other than just the list of news items, and you will want the CMS to manage that content for you.

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.