Plugin suggestion: smart entry URLs

Creating and modifying plugins.
Post Reply
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Plugin suggestion: smart entry URLs

Post by yellowled »

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
onli
Regular
Posts: 2828
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Plugin suggestion: smart entry URLs

Post by onli »

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…
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by yellowled »

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
onli
Regular
Posts: 2828
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Plugin suggestion: smart entry URLs

Post by onli »

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.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by garvinhicking »

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/
Fabien
Regular
Posts: 204
Joined: Wed Mar 15, 2006 1:02 pm
Location: Paris (France)
Contact:

Re: Plugin suggestion: smart entry URLs

Post by Fabien »

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)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Plugin suggestion: smart entry URLs

Post by garvinhicking »

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/
Fabien
Regular
Posts: 204
Joined: Wed Mar 15, 2006 1:02 pm
Location: Paris (France)
Contact:

Re: Plugin suggestion: smart entry URLs

Post by Fabien »

Ooops !
Fabien Chabreuil (blog)
Post Reply