Yarin
Yarin

Reputation: 183829

Filter articles by category with Nesta CMS

We want to display article summaries for a given category.

Standard index page is build like this:

%section.articles= article_summaries(latest_articles)

but I see no way of filtering articles by category.

Upvotes: 2

Views: 70

Answers (1)

Yarin
Yarin

Reputation: 183829

OK figured it out- To list articles by category, you have to assign pages to a given category AND create an actual category page for each category- i.e. a page named the same as the category.

For example, if my page is assigned to categories dogs and cats...

Categories: dogs, cats

I'll need to create new pages called dogs.haml and cats.haml, which will then list the articles for those categories with the standard code found in the default page.haml template:

%section.articles
  = article_summaries(@page.articles)

Upvotes: 3

Related Questions