Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Lowercase category name in url

Quote Reply
Lowercase category name in url
I would like to know of a fix for the category name that shows in the url to be in lowercase.
As in.. domain.com/My_Directory/ being as domain.com/my_directory/

Google seems to have a real problem with uppercase urls but not text title or page text.
I would like the url part changed only. How can I accomplish this?

Any help or being pointed in the right direction would be great. Viewing source code changes would be much appreciated also.
Quote Reply
Re: [SliderMan] Lowercase category name in url In reply to
Quote:
Google seems to have a real problem with uppercase urls but not text title or page text.
I would like the url part changed only. How can I accomplish this?

Does it? This is the first I knew of it. Seems to be fine on my sites (categories with uppercase names get spidered just as well as lowercase ones). The thing you need to just be careful with, is the length of the name, as Google *will* ignore these pages if the foldername is too long.

From personal experience... its not that easy to get Links2 working with a different field for building/searches, as it requires pretty much the whole thing to be modified, so you can lc() the name's Unsure

Hope that helps.

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Lowercase category name in url In reply to
A search for Horse Barn and Farm Equipment is one example
A search for Business Jewelry is another.
Notice the words in caps aren't in bold in either example.
It's a giveaway for what google seems to like. The pages are still spidered. They just aren't considered ideal to work with google as far as ranking. The keyword density in the url will make a huge difference.

Thank you for your reply Andy. Sorry to hear that the whole thing would have to be modified to make the category name in the url lowercase. I had read in another post that someone had done it , but the finished product was in another language. I never seen a download link for it either.

I will keep trying to find some way to make this work if at all possible. If you do come up with any idea please let me know. I like links 2.0 way too much to have to get rid of it.

Thanks again

Last edited by:

SliderMan: Sep 13, 2004, 7:15 AM
Quote Reply
Re: [SliderMan] Lowercase category name in url In reply to
I found where to change the url to lowercase. it won't find the page though now. I'm sure this has something to do with the page still being in uppercase. a reflection of the Category name being the same.
Quote Reply
Re: [SliderMan] Lowercase category name in url In reply to
If you make a change in the category name, you will have to make the same change to every link in that category, or else the link will be an orphan (no category). In your admin, under the Categories label, is a link named Check Cat. Run that, and will find all your links that no longer belong to functional categories (due to name change). It will give you the option to move them to existing categories, too.

Quote:

Check Cat. Make sure every link is in it's proper category. This function will quickly spot any links in an invalid category. You can then either, move the bad links, erase them, or create the missing category!


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Lowercase category name in url In reply to
The Category Check found nothing wrong.

In db_utils.pl file the code I changed was from...

sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g;
return $toencode;

And I changed it to........... shown in red


sub urlencode {
# --------------------------------------------------------
# Escapes a string to make it suitable for printing as a URL.
#
my($toencode) = shift;
$toencode =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
$toencode =~ s/\%2F/\//g;
return lc($toencode);


The url changes to lowercase but the category check doesn't find a problem. I really don't want the on-page text for the category name to be in lowercase.
Post deleted by SliderMan In reply to
Quote Reply
Re: [Andy] Lowercase category name in url In reply to
Andy,

I found the fix finally. No need to to change the whole script.

1. Added categories in all lowercase. (fixes the lowercase url problem)
2. Added code that makes the first letter of each word in a category capital. (code change below)

File db_utils.pl and changes in red. I only had to add one line.

sub build_clean {
# --------------------------------------------------------
# Formats a category name for displaying.
#
my ($input) = shift;
$input =~ s/-/ /g; # Change '_' to spaces.
$input =~ s,/, : ,g; # Change '/' to ' : '.
$input =~ s/(\w+)/\u\L$1/g;
return $input;
}



Problem solved!