Page 1 of 1

rss permalink not working for categories

Posted: Tue Mar 28, 2006 7:10 am
by hotroast
I'm having trouble figuring out why my RSS links aren't working for showing just the items in a single category. My Permalink setting is as follows:

Permalink RSS-Feed Category URL structure:
feeds/%name%.rss

Now, it does seem to work for my primary category. However, when I try grabbing the rss for the second category it returns only the first category posts.

Interestingly enough, I tried www.example.com/rss.php?category=category2 and that worked a bit - it did show the category 2 posts AS WELL AS the category 1 posts!

I'm using serendipity 1.0beta - Any thoughts or suggestions would be most welcome - thanks!

Posted: Tue Mar 28, 2006 8:17 pm
by judebert
Okay. I've been thinking about this all day. Garvin probably knows, but he's sick, and I'm trying to help out, so you're stuck with my feeble attempts.

I'm looking through rss.php, and it appears to do its job as expected (at least where the ?category= bit is concerned). I've even checked out differences in previous versions through berlios, and it still all looks good to me.

The only suspicious thing I see is that plugins get loaded. Maybe one of your plugins is messing up the SQL? What plugins do you have enabled? You could try to disable them and see if that helps, then re-enable them until it breaks again.

Posted: Wed Mar 29, 2006 12:55 am
by hotroast
After further analysis, I'd actually be more inclined to think it may be something to do with the feed2.0 smarty template. I included a copy of the tpl file. Again, the two strange issues is that 1) using the permalink just doesn't work at all (as if it's just the primary category). Secondly, if I use rss.php?category= it's ok for category 1 but shows all category posts if I try to get only category 2 (also, the title line does not show the category name if that gives any clue).

Here is the tpl file:

<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:admin="http://webns.net/mvcb/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
{$namespace_display_dat}>
<channel>
<title>{$metadata.title}</title>
<link>{$metadata.link}</link>
<description>{$metadata.description}</description>
<dc:language>{$metadata.language}</dc:language>
{if $metadata.showMail}
<admin:errorReportsTo rdf:resource="mailto:{$metadata.email}" />
{/if}
<generator>Serendipity {$serendipityVersion} - http://www.s9y.org/</generator>
{$metadata.additional_fields.channel}
{$metadata.additional_fields.image}

{foreach from=$entries item="entry"}
<item>
<title>{$entry.feed_title}</title>
<link>{$entry.feed_entryLink}</link>
{foreach from=$entry.categories item="cat"}
<category>{$cat.feed_category_name}</category>
{/foreach}

<comments>{$entry.feed_entryLink}#comments</comments>
<wfw:comment>{$serendipityBaseURL}wfwcomment.php?cid={$entry.feed_id}</wfw:comment>

{if !$is_comments}
<slash:comments>{$entry.comments}</slash:comments>
<wfw:commentRss>{$serendipityBaseURL}rss.php?version={$metadata.version}&type=comments&cid={$entry.feed_id}</wfw:commentRss>
{/if}

<author>{$entry.feed_email} ({$entry.feed_author})</author>
{if !empty($entry.body)}
<content:encoded>
{*{$entry.feed_body|@escape} {$entry.feed_ext|@escape}*}
{$entry.rss_content|@escape} {$entry.feed_ext|@escape}
</content:encoded>
{/if}

<pubDate>{$entry.feed_timestamp_r}</pubDate>
<guid isPermaLink="false">{$entry.feed_guid}</guid>
{$entry.per_entry_display_dat}
</item>
{/foreach}

</channel>
</rss>

Posted: Wed Mar 29, 2006 4:04 am
by judebert
The feed template you posted looks OK. If there's no title, there's something wrong with the metadata.title variable.

I've been trying it on my own 1.0-alpha2 blog. If I leave the %id% in the permalink, everything works fine. Take it out, and I get your problem. I also left the categories/ in; otherwise, the .htaccess may have problems deciding whether you're looking at an author feed or a category feed.

There may be something we can do in serendity_searchPermalink() to give you the behavior you want. I'm a bit too busy to do it right now, but you're welcome to look at it yourself. I can probably get to it in about a week or so.

Posted: Wed Mar 29, 2006 9:39 am
by hotroast
thanks for your help - with those tips I got it... first of all, I upgaded from 1.0beta1 to beta2, though I don't believe that was the issue. Based on your tips, this is the combination of settings I needed to get it working the way I want:

Path to categories: channels
Path to RSS feeds: feeds
Permalink RSS-Feed Category: feeds/channels/%name%.rss

Apparently, feeds must equal feeds, and channels must equal channels in the "Permalink RSS-Feed Category". If I set the category path to channels, and put the permalink to feeds/categories/%name%.rss - it won't work anymore!

Thanks for your help in solving this, and I hope this helps others as well with permalink issues!

Posted: Wed Mar 29, 2006 9:42 am
by hotroast
btw, seems the issue is still there with going directly to rss.php?category= - not sure why that wouldn't work. Of course it's really not an issue if the other method works (which I prefer anyway) - with the permalinks. But still strange that it's acting that way.

Posted: Wed Mar 29, 2006 10:05 am
by garvinhicking
Hi!

Your analysis of the path problem was the exact right thing. :)

About rss.php?category= you need to pass an ID, not the name to that! IF you submit "category2", the integer casting transforms that to ID #2. :-)

Regards,
Garvin