Page 1 of 1

Related Entries Plugin

Posted: Thu May 13, 2010 8:04 pm
by Cenic
Hi,

I have seen a number of blogs where a related articles section was below every entry. As far as I found out there is nothing similar for Serendipity. So here is the first release of a plugin I wrote.

The plugin uses the tags created by the freetags plugin to connect articles to each other. If two articles have common tags then they classify as related. So if you publish an article tagged as 'Foo' and 'Bar' then other entries with either the tag 'Foo' or 'Bar' are candidates to be shown in the list. Entries that have the tags 'Foo' and 'Bar' are even more likely to be shown. The is a configuration option to limit the number of links to show.

I thought about using the entry category as well but haven't implemented that yet.

A word of caution: this is the first time I created a plugin, so I'm not sure if this is working in all cases. Especially the way the plugin generates the output (by adding code to $eventData['display_dat']) might not be the proper way. I wanted to have the output between the entry and trackbacks/comments and this gave the best results. I'm using a custom template so there might be issues with the template as well.

Download: serendipity_event_related.zip

Comments and fixes by s9y hackers welcome!

Regards,
Stefan

Re: Related Entries Plugin

Posted: Thu May 13, 2010 9:02 pm
by Don Chambers
The freetag plugin already has an option to display related entries.

Re: Related Entries Plugin

Posted: Fri May 14, 2010 10:13 am
by Cenic
Now this is embarrassing... :oops: The formatting is not exactly what I want but I'll start playing with CSS for that. Sorry...

Re: Related Entries Plugin

Posted: Fri May 14, 2010 11:31 am
by yellowled
Cenic wrote:The formatting is not exactly what I want
Recent versions of that plugin have an option to customize the emitted HTML code.

YL

Re: Related Entries Plugin

Posted: Fri May 14, 2010 1:03 pm
by Cenic
It works. With a change to my entries.tpl I was able to display the list of tags and the related links in different places of the page.

Thanks,
Stefan

Re: Related Entries Plugin

Posted: Fri May 14, 2010 2:35 pm
by onli
Good to hear that :)
Don't be too disappointed you oversaw the existing functionality, your plugin seems like quite a solid work, it should help you when you build the next one.

If you have a look at the freetag-plugin (and there at the function addRelatedEntries), you could compare how the output is done there (via addfooter or as extension to eventData[$entry]).