limiting length of url titles
Posted: 19 May 2006 05:36 AM   [ Ignore ]  
Lab Assistant
RankRank
Total Posts:  163
Joined  05-26-2003

Sorry if this has been asked before, but I’d like to limit the length of the automatically-generated url title. The writer on the blog I installed tends to write huge long titles and the URLs get a bit silly.

Is there a setting to indicate how long they should be?

Profile
 
 
Posted: 19 May 2006 07:11 AM   [ Ignore ]   [ # 1 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15823
Joined  06-03-2002

Not if you’re talking about auto links and addresses just pasted in along with the rest of the text.  I would kindly point him/her to pMcode, and make sure that he has the formatting buttons visible in his publish screen to make Link adding painless.

 Signature 
Profile
MSG
 
 
Posted: 19 May 2006 08:12 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
RankRank
Total Posts:  163
Joined  05-26-2003

No, I’m talking about the URL of the actual post that is automatically generated. So, for example, a post titled:

Here’s a title with quite possibly the longest url string ever written. Well, maybe not, but close.

is automatically given the url:
http://www.website.com/index.php/weblog/comments/a_title_with_75_characters_making_it_quite_possibly_the_longest_url_string_ever/

Which, as you’ll admit, is a bit silly. I’d like to limit this as I can’t depend on the author(s) to remember to shorten the urls.

Profile
 
 
Posted: 19 May 2006 08:35 AM   [ Ignore ]   [ # 3 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6535
Joined  04-15-2006

Hi yolise,

I could be wrong but I don’t think that there is a setting for that anywhere. Would probably require a hack on the code to enable you to do that or maybe even a change in the max length on the database table.

Maybe an easier thing to do would be :

If the author really wants to use a long title then allow them to but use a custom field for it. That way they would put a shortened version in the {title} field and then whatever they like in the custom field. You could then spit out the custom field but make the URL reference the {title} field.

I know it means a bit more work on their behalf but if that is really what they want then I don’t think there is another way I’m afraid. I could definitely be wrong though and someone else may be able to provide a solution to your problem.

Hope that helps a bit.

Regards,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 19 May 2006 08:40 AM   [ Ignore ]   [ # 4 ]  
Lab Assistant
RankRank
Total Posts:  163
Joined  05-26-2003

And more work on my behalf. Limiting the database field wouldn’t make sense to me, because the bit before the title part of the url could be a variety of lengths. I’m perfectly happy hacking the code. I assume it’s a simple numerical limit somewhere if someone could just point me to it?

I can’t control the writers and can’t trust them to remember to shorten the urls.

Out of interest, why does it have such a large number? It obviously limits the length, because it truncated that long title. But it is, in my opinion, an excessively large number of characters for a url…

Profile
 
 
Posted: 19 May 2006 08:40 AM   [ Ignore ]   [ # 5 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15823
Joined  06-03-2002

Ah, hm.  Well, you’d probably have to hack the back end.  It’s a javascript function that auto-types the url_title field for you while you write the title.  Truncating it to a set number of characters could have at least one major drawback: it would create URLs that really don’t give meaning to the entry, which hurts both usability and potentially, search engine rankings.  But, you could probably do it if training them on url_titles isn’t an option.  You’ll need to know js, and change the Live URL Title function in cp.publish.php.  I highly, highly dis-recommend this.  I think the effort will be less and the payoff greater to simply tell them to use shorter URL titles that still convey meaning.  A brief explanation of how it impacts search engine results is generally enough to motivate authors to pay attention.

 Signature 
Profile
MSG
 
 
Posted: 19 May 2006 08:52 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
RankRank
Total Posts:  163
Joined  05-26-2003

OK, well, I’ll give it a go and use the hack as a backup plan. Of course, the site is private, password-protected and not spiderable, so the search engins thing is immaterial and not a good stick to beat them with. The biggest issue is that members sending urls to other members (of which there are many) in email messages end up getting it split over two lines and essentially makes the links unusable.

But seriously (and out of interest), don’t you think that url I quoted above is excessively long?

Profile
 
 
Posted: 19 May 2006 09:08 AM   [ Ignore ]   [ # 7 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15823
Joined  06-03-2002

Yes, IMO, it’s excessive as both a URL title and just from the perspective of a title.  That would never fly in a print publication, that’s for sure. wink

 Signature 
Profile
MSG
 
 
Posted: 19 May 2006 09:14 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
RankRank
Total Posts:  163
Joined  05-26-2003

Well, they’re TV people. wink

Now, I think I’d better edit that url string out now, since I know these forums are public and spiderable. Don’t really want anyone running across it by accident.

Profile
 
 
Posted: 19 May 2006 10:16 AM   [ Ignore ]   [ # 9 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6077
Joined  08-04-2002

You run into even longer titles for medical articles. They look more like paragraphs.
Another downside to using the {title} field for long headings is the Edit screen/page/list gets really messy. The width of the Title cell is pretty narrow.
I rarely set up a site where I use the {title} as the “headline”. I almost always set a custom field for that and tell the writers the {title} field is for a quick article identifier/reference (card catalog type of thing).

I definitely wouldn’t hack as then you have to re-hack with every update (been there done that).

Profile
 
 
Posted: 19 May 2006 11:05 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  520
Joined  05-14-2004

Being exceptionally long winded my entry URLs look very ridiculous, but Google loves them.

 Signature 

“I was gratified to be able to answer promptly, and I did. I said I didn’t know.” - Mark Twain, Life on the Mississippi

Profile
 
 
Posted: 19 May 2006 11:05 AM   [ Ignore ]   [ # 11 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6535
Joined  04-15-2006

Hi there yolise,

As a quick update. I haven’t actually checked this yet but I think that it might work. Not currently able to access EE so can’t say. I think that you can actually (after typing in the title) change the auto generated title to anything that you like. I could be wrong because as I say I am not in front of EE at the moment. There may be some caveats to doing that though, I don’t know. Maybe someone could pipe up and let us know??

Also, unfortunately this would also mean that either the author would have to do this which they may moan about doing or you would have to go in on each new entry and change them yourself.
Just an idea though. Sorry my first idea didn’t help.

Best wishes,

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
Posted: 19 May 2006 11:08 AM   [ Ignore ]   [ # 12 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15823
Joined  06-03-2002

Yes, you can type whatever you want in the url_title, but the problem yolise has is that the authors aren’t likely to pay attention to instructions to shorten it before submitting an entry.

 Signature 
Profile
MSG
 
 
Posted: 19 May 2006 11:12 AM   [ Ignore ]   [ # 13 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6535
Joined  04-15-2006

Hack it is then!!!

Be careful though. Personally I think that if you are the admin of a site and you are letting people submit to it then they should really follow your suggestions on posting. Not really too much to ask I don’t think. You could always delete their posts if they are too long.

I’m sure they would soon get the picture?? smile

Seriously though good luck with it all.

Mark

 Signature 

Full List Of Plugins Here!! (16)
 
Retrieve Statuses
Maximum Posts Reached
Neat Link
Redirect
Fetch URI

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64877 Total Logged-in Users: 70
Total Topics: 81802 Total Anonymous Users: 43
Total Replies: 439747 Total Guests: 314
Total Posts: 521549    
Members ( View Memberlist )
Newest Members:  dxrsmdanbilly8hrkiliwysso50kexpressoKlaasdarrenstylestravelerjcatoncvadrata