Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hi everyone,

What would be the smartest way to categorize blog posts with, possibly, multiple categories?

On couchcms tutorials I see a recommendation to use "folders" for this. But then my client won't be able to add/remove/edit new categories himself. Also, this only seems to allow a single category for each blog post. So, I basically need:

- On the BLOG page, where all posts are displayed, a possibility for the user to filter and see just ONE specific category;
- on a POST page, the user can see on how many categories this particular post is associated with;

Thanks in advance!
F.
Hi,

But then my client won't be able to add/remove/edit new categories himself.

This is actually no longer the case - please see https://docs.couchcms.com/miscellaneous ... lders.html

Using the above mentioned 'Dynamic Folders', however, will still allow only a single folder to be associated to any given page.

If you really must have multiple categories, then you may take a look at 'tags' - viewtopic.php?f=8&t=8952

Hope this helps.
Thanks @KK !

I'm following the blog tutorial to make use of dynamic folders but can't understand the logic on how to show only posts that are associated with a specific folder.

Here's my site:
https://helderdarocha.com/arcomaior/noticias/index.php

Basically I have two pages:

noticias/index.php (shows all blog posts)
noticias/post.php (shows content for single post - using this one as masterpage)

The left sidebar of page index.php shows all existing folders (categorias). The code follows the blog tutorial:

Code: Select all
<cms:folders masterpage='noticias/post.php' folder=k_folder_name paginate='1' >
       <li><a href="<cms:show k_folder_link />"><cms:show k_folder_title /></a></li>
</cms:folders>


With this all categories are displayed: atualidades - geral - imprensa, but because they must be associated with masterpage "noticias/post.php", each link takes me to a unique post.php?f=X that obviously doesn't fit my needs (what I want here is to click on "atualidades" and show all and only the posts associated with this folder).

What would be the logic solution to make this work? Because if I make index.php my masterpage, I can't output content on post.php as it should be the default "k_page_link" …

Thanks in advance <3
Hi,

Any specific reason why you need two separate templates for the blog?
Though it is certainly possible to use any template (e.g. noticias/post.php in your case) to display data from any other template (e.g. noticias/index.php in your case), this arrangement introduces complexity that can be easily avoided.

It'd be better to use a single template (say noticias/index.php) for displaying all posts (using home-view), posts of a single folder (using folder-view) and a single page (using page-view).

So, assuming all posts are cloned pages of noticias/index.php, you can use dynamic-folders in the same template and then use its folder-view to show pages belonging to discrete folders.

You may find details about views here -
https://docs.couchcms.com/concepts/views.html
https://docs.couchcms.com/concepts/vari ... views.html
https://docs.couchcms.com/concepts/listing-pages.html

Please let me know if something is unclear.
Done! It's working like a charm.

Only needed the references from this one:
https://docs.couchcms.com/concepts/views.html

Thanks KK you rock big time!
You are welcome :)
6 posts Page 1 of 1