Plugin suggestion: smart entry URLs

Creating and modifying plugins.
Post Reply
User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Plugin suggestion: smart entry URLs

Post by yellowled » Thu Sep 26, 2013 1:15 pm

Let's say I publish my first article in a new blog with the title “First post”. The URL to that article would very likely (unless I fiddle with permalinks or don't use rewriting) be /01-first-post.html in a s9y blog.

Now if I change that entry title to, say, “Open for business”, the entry url will subsequently change in s9y blogs to /01-open-for-business.html, which isn't really cool (cool URLs don't change) and might result in SEO penalties at some point (if one were to do so frequently).

That's pretty easy to solve – if the blog uses mod_rewrite – with a permanent redirect. But it's a tedious task, and new users might not be familiar with editing the .htaccess file. Could we have a plugin which generates these rewrite rules and adds them to the .htaccess automagically on save if the entry title changes? Anybody got some spare time for that?

(I wouldn't be opposed to having that in the core, but I think it's a plugin functionality.)

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Plugin suggestion: smart entry URLs

Post by onli » Thu Sep 26, 2013 1:33 pm

I was under the impression the core already takes care of that? Though I'm not sure if that is by a rewrite-rule or because only the id is important. Or was that in dsnblog? No, at least in my blog, http://www.onli-blogging.de/1340/Kurze- ... ldung.html and http://www.onli-blogging.de/1340/Kurze- ... dung2.html lead to the same page…

User avatar
yellowled
Regular
Posts: 7036
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by yellowled » Thu Sep 26, 2013 2:12 pm

onli wrote:I was under the impression the core already takes care of that? Though I'm not sure if that is by a rewrite-rule or because only the id is important.
Erm … okay … confirmed. That works in my test blog as well (didn't think to check that). But there's no redirect for that im my .htaccess. :shock:

Anybody care to explain how that works? Garvin?

YL
amazon Wishlist - Serendipity-Podcast (German only, sorry)

User avatar
onli
Regular
Posts: 2231
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Plugin suggestion: smart entry URLs

Post by onli » Thu Sep 26, 2013 2:26 pm

I guess I know how that works, I just wasn't sure whether that was because of me mixing this up with my own blog engine. Basically, all we are doing is parsing the entry-id out of the url if s9y detects that this is a pattern of an entry url, and having that entry-id, s9y is able to print the current page. Given ids are unique, that is perfectly fine and covers the case of an user changing the title of an entry.

But: When editing an entry we have to make sure that the id is set in the entry-form, at least when working on 2.0 there were some strange JS-calls for doing that. I hope that was a result of the workover, but an issue on that part could mean that sometimes it won't work, as without the id present a new entry with a new id would be generated. We should make sure there is no such bug when we are done.

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by garvinhicking » Fri Sep 27, 2013 10:04 am

Hi!

Yellowled: It works with a rewrite rule and index.php checks for %id% in the permalink. ;)

Other than that if you don't want your permalink to change when changing a blog title, use the custom permalink event plugin to assign your own permalinks.

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Fabien
Regular
Posts: 161
Joined: Wed Mar 15, 2006 2:02 pm
Location: Paris (France)
Contact:

Re: Plugin suggestion: smart entry URLs

Post by Fabien » Mon Oct 07, 2013 10:32 am

Hi,

What I woul like is to have a field to choose the URL. Default value as it is now and possibility to correct it or to enter a new one.

Cheers, Fabien
Fabien Chabreuil (blog)

User avatar
garvinhicking
Core Developer
Posts: 30020
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by garvinhicking » Mon Oct 07, 2013 11:03 am

Hi Fabien!

Exactly this is offered by the serendipity_event_custom_permalink event plugin!

HTH
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/

User avatar
Fabien
Regular
Posts: 161
Joined: Wed Mar 15, 2006 2:02 pm
Location: Paris (France)
Contact:

Re: Plugin suggestion: smart entry URLs

Post by Fabien » Mon Oct 07, 2013 11:20 am

Ooops !
Fabien Chabreuil (blog)

Post Reply