Forum

Thread tagged as: Question, Blog

Custom blog post URL

Hello,

On my blog I want to change the title of the post, without the URL changing. So I was thinking of a custom field to set my own URL. What would be the best practice to achieve this?

Thanks, Mike

Mike Hendriks

Mike Hendriks 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You should be able to use type="slug" for that.

So, would I put this in my post.html:

<perch:blog id="customurl" type="text" label="Custom URL" required>
<perch:blog id="slug" type="slug" for="customurl">

Should I change the 'Blog post page path: /blog/{postSlug}' or 'Slug format: {postTitle}' to something else?

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, to the ID of the new field.

Should I change both? It is not yet working.

post.html:

<perch:blog id="customurl" type="text" label="Custom URL" required>
<perch:blog id="slug" type="slug" for="customurl">

post_in_list.html:

<a href='<perch:blog id="slug" type="slug" for="customurl">'>Lees de argumenten</a>

Blog post page path: /blog/{customurl}

Slug format: {customurl}

The link is now redirecting me to the same page I am on.

I fixed it, thanks. The ID was the problem indeed