View Full Version : Stop PhotoPost From Stripping Out Hyphens in SEO URLs?
October 24th, 2010, 04:30 PM
Now that I've got SEO links on, I can see a problem with some of my links -- it strips out some hyphens in category names and photo titles, making the links less intelligible and SEO worthy. For example:
In the above example, the original title was "All Star Movies - Cinema Hall" and this gets parsed to "all-star-moviescinema-hall"
Here's another example:
In this example, the category name is "Animal Kingdom Lodge - Dining" but it gets parsed out to "animal-kingdom-lodgedining"
I located the function that creates these SEO urls (function ppurlsafe in pp-inc.php), but I can't see where it is effectively replacing " - " with ""
Can you help me out so I can try to change this?
October 24th, 2010, 06:33 PM
Each word is a search term in the search engines thus the titles appear as you see them. I am sorry but we can not assist with code modification questions.
October 26th, 2010, 03:04 PM
Okay ... but wouldn't stripping out hyphens, which is part of the title of the category or the photo, be a bug? It makes the URLs not SEO friendly, which is the whole point. I found the code on my own. Should I file a bug report?
October 26th, 2010, 06:10 PM
well I will pass it to Michael but basically what we do is just grab all words in a catname or photo title and then insert hyphens between each word.
I would suspect maybe you do not have space between hyphens
All Star Movies-Cinema Hall
I know if you remove the hyphen then there is no space between that will be two words. Basically this is not really so much a bug but how Michael has chosen to handle titles with seo.
October 26th, 2010, 07:17 PM
Its in the ppurlsafe() function in pp-inc.php; it would need to be modified to not remove the multiple dashes. Honestly, it would probably need to be rewritten since we use dashes to replace non-alphanumberic.
October 27th, 2010, 08:03 AM
Well the issue is the empty spaces and hyphen
All Star Movies - Cinema Hall
That is written as
Now if the title is this
All Star Movies-Cinema Hall
then it is correctly written like this
So really the thing it has a problem with is the use of a hyphen with spaces on either.
There is a more elegant way of redoing the regex I am sure but adding this line as a test in the ppurlsafe function in pp-inc.php seemed to work for me on a test title
$string = str_replace(' - ', ' ', $string);
October 27th, 2010, 07:16 PM
Sure, that would work, as its replacing what would become --- reduced to none to 1 that wouldnt change.
October 27th, 2010, 07:59 PM
yeah well in the end the space hyphen space becomes nothing so yeah the only thing I have found that works is that explicit str_replace. Kinda the same thing I do for those umlates etc
October 27th, 2010, 08:09 PM
Yeah tried a few other things thats the only thing that works.
November 14th, 2010, 05:24 PM
I`ve got the same, and a similar, Problem.
"Photo-Title" becomes "PhotoTitle".
Will the following Code work in pp-inc to get "-" into a "_" ?
$string = str_replace('-', '_', $string);
I`ve got some more Problems with "," and ":" in Titels. They seem to be changed in "2c" or something strange ?
November 14th, 2010, 07:42 PM
I would suggest something like post 6 to remove the hyphen and then the code will insert one.
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.