This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Stranger Pings
Stranger Pings

I have read up and made a simple plugin that fetches a list of items. I can link those items to an item page. But what is the best practice when grouping those items to categories? I would like to list all categories on one page and then show items for that category when the user clicks on that category.

Crazymodder
Crazymodder

Hi,

What do you mean with best practice? I think you can do it like the blog Plugin does it. In October you can define custom routes. Inside this routes you can use Variables like {slug}. So you can decide how to design those links. From Seo perspective it's better to do not make depth structures. so its better to have http://domain.com/post-title or maybe http://domain.com/categoryname/post-title but not http://domain.com/category/subcategory/subsubcategory/post-title

Hope this helps you Regards Crazymodder

Stranger Pings
Stranger Pings

Well I have managed to make an item page and items loop of all items. I want to also create a categories page which fetches the items belonging to that category. But I am struggling to see how to link the :slug for categories to the items. Because categories is a separate table. So I have a belongsto and I can attach a category to an item but I also need the category :slug to attach.

So far I have http://domain.com/items and http://domain.com/item/item-01 but I want to also have http://domain.com/items/category to list all items belonging to that category and then link to http://domain.com/item/item-01.

ndcisiv
ndcisiv

You can also look at the Catalog plugin, it has products and categories that are simple to follow.

Stranger Pings
Stranger Pings

Thankyou @nindcisiv, I will check that out.

1-5 of 5

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.