Forum

Thread tagged as: Runway, Question

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

Dan Lee

Dan Lee 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What value have you set for "URL for single items" in the collection options?

Dan Lee

Dan Lee 1 points

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}

Drew McLellan

Drew McLellan 2638 points
Perch Support

You would do something more like this:

/documents/{a}/{b}

Where a and b are IDs from your collection.

Dan Lee

Dan Lee 1 points

I'm halfway there... I use catSlug but this doesn't display the category name... am I missing something?

documents/{catSlug}/{titleSlug}
Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think that will work, as which category slug would we use?

Dan Lee

Dan Lee 1 points

So are you saying there isn't a way to know which category the item is in?

Drew McLellan

Drew McLellan 2638 points
Perch Support

An item could be in lots of categories - so there's no way to know which of those category slug should be used.

Dan Lee

Dan Lee 1 points

Good point - Looks like I need to re-work the url structure.