Handbuch für Serendipity bestellen
Das offizielle, umfassende Serendipity-Handbuch für Einsteiger und Profis ist nun im Handel und kann online bei Amazon oder OpenSourcePress, oder auch bei jedem Buchhändler, bestellt werden!
|
Forum-Information
Before posting about errors, make sure that the answer cannot already be found
in our FAQ or by searching this forum!
Posting is restricted to registered users ( registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.
|
Random stuff about serendipity. Discussion, Questions, Paraphernalia.
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Wed Dec 06, 2006 1:34 am
I am just moving away from WordPress and got most of the site up and running with no problems at all. The only thing that I have ran into is that the permalinks have changed. I've changed the format of them to match the WP style, but it seems that s9y's titles are capitalized while WP's are not. I've tried the extension for custom permalinks but that seems to require .htm or .html at the end of the link.
The real question, is there a way to make the title:
my.domain.com/year/month/day/This-is-a-Pages-Title
turn into
my.domain.com/year/month/day/this-is-a-pages-title
the current setting in the config
%year%/%month%/%day%/%title%
I have no problem at all editing any of the source files or creating my own plugin if thats what needs to happen.
Thanks,
Zac Garrett
A new s9y user
-

garvinhicking
- Core Developer
-
- Posts: 26675
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
Re: Moving from WordPress - Permalinks Changed
by garvinhicking » Wed Dec 06, 2006 11:58 am
Hi!
Hm, sadly I know of no easy way to make a plugin do that for you.
But since you're willing to patch code, this is what I'm suggesting you.
Open your include/functions_permalinks.inc.php file. Find this:
- Code: Select all
function serendipity_archiveURL($id, $title, $key = 'baseURL', $checkrewrite = true, $entryData = null) { global $serendipity; $path = serendipity_makePermalink($serendipity['permalinkStructure'], array('id'=> $id, 'title' => $title, 'entry' => $entryData)); if ($checkrewrite) { $path = serendipity_rewriteURL($path, $key); } return $path; }
replace it with: - Code: Select all
function serendipity_archiveURL($id, $title, $key = 'baseURL', $checkrewrite = true, $entryData = null) { global $serendipity; $title = strtolower($title); $path = serendipity_makePermalink($serendipity['permalinkStructure'], array('id'=> $id, 'title' => $title, 'entry' => $entryData)); if ($checkrewrite) { $path = serendipity_rewriteURL($path, $key); } return $path; }
That "strtolower" insertion should be what you're after, I hope.
Best regards,
Garvin
-

judebert
- Regular
-
- Posts: 2478
- Joined: Sat Oct 15, 2005 6:57 am
- Location: Orlando, FL
-
by judebert » Wed Dec 06, 2006 4:44 pm
Garvin, since Serendipity is so obviously superior, I'm expecting a rush of WordPress and other users once word gets out. I propose we add an additional parameter to the permalink structure: %lowertitle%. I think this would help migrating users, since they won't have to lose their search engine ranking or modify existing bookmarks.
-

garvinhicking
- Core Developer
-
- Posts: 26675
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
by garvinhicking » Wed Dec 06, 2006 5:00 pm
Hi!
That's a good idea. A patch would be this:
- Code: Select all
Index: include/functions_permalinks.inc.php =================================================================== --- include/functions_permalinks.inc.php (revision 1520) +++ include/functions_permalinks.inc.php (working copy) @@ -505,7 +505,7 @@ */ function serendipity_makePermalink($format, $data, $type = 'entry') { global $serendipity; - static $entryKeys = array('%id%', '%title%', '%day%', '%month%', '%year%'); + static $entryKeys = array('%id%', '%lowertitle%', '%title%', '%day%', '%month%', '%year%'); static $authorKeys = array('%id%', '%username%', '%realname%', '%email%'); static $categoryKeys = array('%id%', '%name%', '%description%'); @@ -523,10 +523,14 @@ $ts = serendipity_serverOffsetHour($data['entry']['timestamp']); + $ftitle = serendipity_makeFilename($data['title']), + $fltitle = strtolower($ftitle); + $replacements = array( (int)$data['id'], - serendipity_makeFilename($data['title']), + $fltitle, + $ftitle, date('d', $ts), date('m', $ts), date('Y', $ts) @@ -568,8 +572,8 @@ * @return string The regular expression to a permalink URL */ function serendipity_makePermalinkRegex($format, $type = 'entry') { - static $entryKeys = array('%id%', '%title%', '%day%', '%month%', '%year%'); - static $entryRegexValues = array('([0-9]+)', PAT_FILENAME_MATCH, '[0-9]{1,2}', '[0-9]{1,2}', '[0-9]{4}'); + static $entryKeys = array('%id%', '%lowertitle%', '%title%', '%day%', '%month%', '%year%'); + static $entryRegexValues = array('([0-9]+)', PAT_FILENAME_MATCH, PAT_FILENAME_MATCH, '[0-9]{1,2}', '[0-9]{1,2}', '[0-9]{4}'); static $authorKeys = array('%id%', '%username%', '%realname%', '%email%'); static $authorRegexValues = array('([0-9]+)', PAT_FILENAME_MATCH, PAT_FILENAME_MATCH, PAT_FILENAME_MATCH);
But I don't dare to commit this to the 1.1 release tree because of possible borkage. So I just created the 1.2 branch for s9y
Regards,
Garvin
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Wed Dec 06, 2006 7:12 pm
Garvin, thanks. I will try this later today when I get a chance and report back.
Thanks,
Zac
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Wed Dec 06, 2006 7:54 pm
Okay, so I couldn't wait.
I've now got my links from google and other search engines back to a working state. I used strtolower as was suggested and also had to add a slash at the end of the permalinks to exactly match my old links.
current format: %year%/%month%/%day%/%title%/
Thanks,
Zac
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Wed Dec 06, 2006 10:48 pm
It is seeming that WP removes non alpha-numeric info from their permalinks. On my site the title of one of my posts includes a + and = which WP ignores. Serendipity removes the equal (+) but not the plus (+). I personally do not mind a few things being broken as my site is not old enough to have it matter all that much. I am just posting as a FYI to future WP to s9y users.
Since we are talking about WP to s9y I think that is also worth mentioning that when importing data the database user needs to have access to both databases. A simple one liner in the import tool would have saved me a bit of time trying to figure it out.
I will keep reporting back if I find problems/differences so that you can make it as simple as possible to get WP converts like myself.
Thanks,
Zac
-

garvinhicking
- Core Developer
-
- Posts: 26675
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
by garvinhicking » Thu Dec 07, 2006 10:58 am
Hi chickens!
You can change the characters that are translated in the same functions_permalinsk.inc.php file - see the first function "serendipity_makeFilename". There you could add also "+" to the list of chraracters that get replaced/removed.
Best regards,
Garvin
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Fri Dec 08, 2006 12:25 am
When I added the + to the array the links changed, but the actual pages did not. I tried to update my .htaccess file by changing the permalink structure in the admin, but that didn't get the links working. I will play around with this much more tonight or tomorrow as I've got the day off of work.
Thanks for your help.
Zac
-

garvinhicking
- Core Developer
-
- Posts: 26675
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
-
by garvinhicking » Fri Dec 08, 2006 10:33 am
Hi!
Ah, okay, it could be that changing that function would not rebuild all the permalinks. You can force rebuilding all permalinks by changing one of the patterns in the configuration, save, and then change it back to the proper path...
HTH,
Garvin
-
chickens
- Regular
-
- Posts: 192
- Joined: Wed Dec 06, 2006 1:15 am
- Location: Vegas
-
by chickens » Fri Dec 08, 2006 11:02 pm
Perfect!
I knew it was something simple that I wasn't thinking of.
Thanks again,
Zac
Return to General discussions
Who is online
Users browsing this forum: Google [Bot] and 1 guest

|