Forum

Thread tagged as: Question, Runway

List and Detail Pages in Runway

What is the best way to do list and detail pages with collections in Runway. This would have to be done with 2 pages vs due to flexibly within the template/design.

I have 1 page that is pulling in all the listing information I just am not sure how to pass it to a details page. Before with Perch It would just be ?s= and I would re-write it with .htaccess but in runway there is now routing and I am just not sure what is the most efficient way to do this.

Thanks in advance.

Brandon Livengood

Brandon Livengood 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

So in Runway it's just a bit simpler, but the principals are the same.

Say you have a collection of articles. Your listing page might be

/articles

Your article detail page might be something like /article/detail, but you want it to respond on URLs with a slug like:

/articles/the-moon-is-made-of-cheese

So you'd set up a route for the detail page like

articles/[slug:s]

Then you can just use perch_get('s') on the article detail page to get the slug as normal.

Ok I will try that, I thought I had to make custom tokens.

Drew McLellan

Drew McLellan 2638 points
Perch Support

You only need a custom token if one of the built in tokens doesn't match your format of URL segment, or if you want to match across multiple segments.

so my path is

/products/reclaimed-flooring/details

and my url pattern is

/products/reclaimed-flooring/[slug:s]

and my template link is

<a href="/products/reclaimed-flooring/<perch:content id="slug" />"><perch:content id="title" /></a>

But when I navigate to the link it doesn't work unless I add the /details?s=slug into the string of the url. Any ideas?

Drew McLellan

Drew McLellan 2638 points
Perch Support

When you say it doesn't work - what do you get?

It was just reloading the page nothing was happening. So I double checked the details route and it looked good. So then I clicked on the routes link to view all routes and there was another route that was attached to the listing page that was not supposed to be there. I then deleted it and it now works.

Thanks

I'm having a similar issue with 2 page list/detail pages. I've got an event listing page working fine, but the event detail page only works at /events/event?s=event-name, not at /events/event-name. /events/event-name just shows the event listing page.

I'm using the route events/[slug:s] which I'm guessing isn't working… I've tried events/[slug:slug] ('slug' being the id of the slug on my event detail template). I've checked my events (the listing) page's Page Options and it's only got the route 'events' which shouldn't be clashing.

Not sure what Brandon means by 'clicking on the routes link to view all routes' but that might be the answer. Do you know what I might be doing wrong?

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Hi Martin

please start a new thread if you have an issue so we can track it - on busy days if you post to old threads they will never be answered as they are marked closed!

Rachel

Would you believe it, the 'events' route on the listing page was getting in the way. Removing that route fixes the detail page. But now the listing page is 404ing. If I add a route back onto the listings page the listings page works but the detail page just shows the listing again. I've tried it with 'events', '/events', 'events/' and '/events/', and all do the same.

I've also tried changing the location path of the listing page from '/events/' to '/events/events', '/events/index' and '/events/index.php', but that doesn't make any difference.

Oh, sorry Rachel I'll post this to a fresh thread :)