Page 1 of 1

December '99 - a quiet month

Posted: Mon Oct 09, 2006 10:25 am
by Random
Hi guys -

I'm experiencing a little wierdness with some of my archive entries: any post that has a single-word title with no punctuation in it will not display when you click on the title. Instead it goes to the archive page for December '99, which is obviously empty.

Check out my May and June archives here:
http://www.andthenhesaid.com/blog/archi ... mmary.html
http://www.andthenhesaid.com/blog/archi ... mmary.html
Three posts (audit, incoming and shahbazalangadingdong) fit this criteria and display this behaviour.

Has this been encountered before in this form - I saw someone had something not dissimilar last year, but couldn't find a resolution.

Thanks in advance,

A

Re: December '99 - a quiet month

Posted: Mon Oct 09, 2006 12:54 pm
by garvinhicking
Hi!

This is caused because you changed the URL of your permalinks to no longer contain the %id%. IF that is the case, Serendipity needs to query the database to find which article you want to see.

It queries the "serendipity_permalinks" DB table, which should contain the link for your entry. Could you check this table and see if you have entries for the URLs that you're having trouble with?

The immediate solution would be to insertt %id% again into your permalink patterns; the REAL solution would be to check if some of the regular expressions to match an article URL are not properly working.

One thing to easily try would be to change %title% to "x-%title" for a test in your permalink pattern. It might be that s9y currently requires that at least one "-" is contained in your Links (because usually '-' is used to seperate ID and Title). If that's the case, of course I'd like to fix it. :)

Regards,
Garvin

Posted: Mon Oct 09, 2006 4:32 pm
by Random
I can confirm that adding %id% solves the problem. I will have a look at the database contents this evening when I get home from work so we can work towards troubleshooting the wider issue. I *think* it also speeds up the page load times, which had been quite slow - but I won't be able to confirm that until I get home and back on dial-up.

As a point of interest, I have a post with a one word title followed by an exclamation mark (!) and that wasn't affected by the problem - could it be that it doesn't only need to find a dash, but any punctuation would do instead?

Posted: Mon Oct 09, 2006 4:35 pm
by garvinhicking
Hi!

Definitely, adding %id% speeds up page generation a lot. It saves you one intense DB lookup. :-)

Just report back here if you get the chance to look at it :)
As a point of interest, I have a post with a one word title followed by an exclamation mark (!) and that wasn't affected by the problem - could it be that it doesn't only need to find a dash, but any punctuation would do instead?
That's a good point, it might help us in locating the problem (which should be in index.php, all the permalink preg_match patterns)

Regards,
GArvin

Posted: Mon Oct 09, 2006 9:45 pm
by Random
Have checked the database (after removing the %id% from the permalinks again). The three posts do appear in it.

Before I put the %id% back again (which I will do whatever the outcome because of the speed benefit) are there other tests it would be useful for me to run to help you? Or would it be useful for you to have access to my database and S9y installation?

Posted: Tue Oct 10, 2006 10:12 am
by garvinhicking
Hi!

I have a good and a bad message. :)

The good is, I could isolate and explain it:

In index.php, Serendipity processes the URI with many, many regular expressions. One after another. The first regular expression that matches will execute the view that was matched.

In your case, something like /archives/blurb.html is matched against those regular expressions:

1. @/archives([/A-Za-z0-9]+)\.html@
2a. @/([0-9]+)[_\-][0-9a-z\.\_!;,\+\-\%]*\.html@i
2b @archives/[0-9a-z\.\_!;,\+\-\%]+\.html@i
3. and several more that are of no relevance now.

As you might see, preg match 2a/2b are the ones that match on your URLs with more than one word, because the "-" character is allowed in there, but not in the first regexp.

However, for single words, the first regular expression matches - but this one actually is for the "archives" view, and not the "entries" view.

To fix this behaviour, you could change your path permalink to "entry/%title%.html", to avoid that the path "entry" is being matched by the general "archives" path which will print archives of a date.

We could also generally fix this by moving the regular expressions around in the index.php file and put the single entry preg match before the archives match.

Now on for the bad news: Both fixes have issues. The first variant will require you to alter a path structure, which you might not want. And the second variant could introduce much larger borkage, because the regexps are a very core part of s9y, and moving their structure around might have side-effects of currently working matching rules -- so I'd actually like to avoid it.

Anyways - using %id% in the permalink is the best thing you can do. *g*

Best regards,
Garvin