When you create a collection it asks for a url.
Then when you create items in that collection it asks for it’s slug.
Suppose I have collection CATEGORIES and items A, B and C, it should be like:
…/categories/a
…/categories/b
…/categories/c
Then I have another collection PRODUCTS, with items that reference one of the CATEGORIES, so I can filter them.
I’m trying to build my CATEGORIES template page so every category will show its corresponding products. It works, but
I can’t set an element to dynamically link to other categories https://s17.postimg.org/5hvv3py27/image.png
It only gives me “None” or “Current Category” options, and even when I select “Current Category” it points to Designer
To have a category page list out products for that category you will want to add a dynamic list to your category template.
Connect that list to your products collection. It should then list out all of you products. Then in the settings for that list you should be able to filter the list based on current category. The filter option literally says filter by current category. This should limit the list to only products you have tagged with that category.
Hope that helps. If not feel free to post your read only link so we can have a closer look.
Actually, I’ve already done that, as I said, It works
My issue is on creating links to other categories pages, I’m don’t know how to dynamically retrieve their URLs.
It’s the same process add a dynamic list and connect it to the categories collection. Add a link to the list and connect it like you would with products.
@LuckyScooby
I think that you should add a type field that is a ‘link’ in your ‘category collection’…after that put the slug in the link field in each of the ‘names’ in the category.
go to your category page template and insert a ‘link block’ in the ‘dynamic items’ and put the ‘category name’ inside the link block.
click the ‘link block’ and go to the setting–>then you can pull the URL…
@Gambit, I’ve thought about that… The problem is that the CMS does not allow me to put links like
/categories/a
/categories/b
/categories/c
It requires me to use full URL. Then I would have to manually change every category, one by one, and repeat it when I publish to custom domain.
Well…
I managed to accomplish what I was intending to.
The problem happens when you try to create dynamic links to other categories from inside the categories template page (which is already dynamic and referring to current category). The solution was to create the links from a static page, then create a symbol for those links and drop an instance of it inside the template page.
It’s weird, because I used the same way to link, however it only works inside the template if you build the links outside it.