Combining Multiple CMS Collections for Category Pages

Subscribe to our YouTube Channel

If you’re looking to create category pages on your website, you may want to consider combining multiple CMS collections. This technique allows you to filter content based on the page you’re on, all while using just one template.

Setting Up the CMS

To illustrate how this works, let’s take a look at a simple blog about running. We have a grid of posts, post pages, and author pages that show a bio and the posts the author has written.

To set this up, we need to have two collections: articles and authors. We can assign authors to posts and update their information in one place. We reference the author’s slug in the post collection to find the author in the author’s collection later on.

Nesting Collections

To show the author’s name on the post page, we need to nest collections inside of other collections. We can filter the data based on the slug of the author and show it on the post page. We can use this trick on all other pages as well, such as the article page and author page.

Benefits of Combining Collections

By combining collections, we can easily create category pages and filter content based on the page we’re on. This technique is powerful and can save time when setting up templates and categories on your website.

Setting Up the CMS

To illustrate how this works, let’s take a look at a simple blog about running. We have a grid of posts, post pages, and author pages that show a bio and the posts the author has written.

To set this up, we need to have two collections: articles and authors. We can assign authors to posts and update their information in one place. We reference the author’s slug in the post collection to find the author in the author’s collection later on.

Nesting Collections

To show the author’s name on the post page, we need to nest collections inside of other collections. We can filter the data based on the slug of the author and show it on the post page. We can use this trick on all other pages as well, such as the article page and author page.

Benefits of Combining Collections

By combining collections, we can easily create category pages and filter content based on the page we’re on. This technique is powerful and can save time when setting up templates and categories on your website.

Setting Up the CMS

To illustrate how this works, let’s take a look at a simple blog about running. We have a grid of posts, post pages, and author pages that show a bio and the posts the author has written.

To set this up, we need to have two collections: articles and authors. We can assign authors to posts and update their information in one place. We reference the author’s slug in the post collection to find the author in the author’s collection later on.

Nesting Collections

To show the author’s name on the post page, we need to nest collections inside of other collections. We can filter the data based on the slug of the author and show it on the post page. We can use this trick on all other pages as well, such as the article page and author page.

Benefits of Combining Collections

By combining collections, we can easily create category pages and filter content based on the page we’re on. This technique is powerful and can save time when setting up templates and categories on your website.