Forum

Thread tagged as: Problem, Runway

Custom url for search result

Hi,

Adding search functionality to a runway site. The search results template uses <perch:search id="result_url" /> to get the url and as far as I can see here https://docs.grabaperch.com/templates/search/ and in perch:showall, it's not possible to get custom fields. My problem is that I allow the editors to change the blog posts' slugs with a custom text field. This means that the search results items have wrong urls.

I had a hope that the issue with editing post slugs would have been fixed after P3 but looks like not yet. https://forum.grabaperch.com/forum/06-26-2016-changing-the-blog-post-slug

Can you think of any way around the problem? And out of curiosity, is fixing the blog slug system any close to be prioritised?

Proko Mountrichas

Proko Mountrichas 3 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

That slug issue is entirely with the Blog app, so nothing to do with Perch itself. It remains the same for Perch 3 as it was in Perch 2.

What's the value of the post URL in Settings?

Hi Drew. I have Blog post page path: /post/{postSlug} and Slug format: {postTitle}. Is any of these what you asked for?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, so /post/{postSlug} is what you should get for your search URL

I do. In the results I'm getting the posts with url: post/this-is-the-post-title. And what I wand to get is: post/this-is-the-custom-slug-users-add-in-admin.

Drew McLellan

Drew McLellan 2638 points
Perch Support

So you should fix that option in Settings to be correct.

Well, the only fix I can think of is to use /post/{customPostSlug} or /post/{postUrl}. Both hold the correct value when checked in perch:showall but when I use them in the Settings, I only get /post as the url. The two fields come from the post.html

<perch:blog id="customPostSlug" type="slug" for="postUrl" editable="false" suppress="true"/>
<perch:blog id="postUrl" type="text" label="Post URL" size="xl autowidth" order="1" suppress="true"  />
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, we'll take a look at it.

Thanks! I'm actually surprised this is not a popular fix request. Custom blog URLs are crucial for SEO and quite mandatory for migrations.