Forum
Search Result Links Not Working with Collections
I have created multiple collections in Perch Runway attached to pages and then set up a search. Items appear in the search results fine - but the links through to the collection items don't work.
The following code:
<a href="<perch:search id="url" />">
renders the link as:
https://sitename.com/Collection
when it should be:
https://sitename.com/collection/category/collection-item
Is there anything I need to keep in mind when trying to link through to items? Should I be using the slug and categories somehow? Is logic required?
Thanks
What value have you set for "URL for single items" in the collection options?
Nothing as it turns out...
The collection is called "documents" and the category and item will be dynamic so I'm not entirely sure what I should be using for those elements but I'm guessing it follows this format:
documents/{slug:ca}/{slug:s}
You would do something more like this:
Where
a
andb
are IDs from your collection.I'm halfway there... I use catSlug but this doesn't display the category name... am I missing something?
I don't think that will work, as which category slug would we use?
So are you saying there isn't a way to know which category the item is in?
An item could be in lots of categories - so there's no way to know which of those category slug should be used.
Good point - Looks like I need to re-work the url structure.