Firefox PHP

Module: Meta Description

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
meta_description-1.1.3.zip 4.9 KB open | download Maurice Makaay 10/27/2009 Read message
meta_description-1.1.3.tar.gz 3.4 KB open | download Maurice Makaay 10/27/2009 Read message
Module: Meta Description
August 05, 2007 05:07PM
This module will set the {DESCRIPTION} template variable to an appropriate value for using it in a meta description HTML tag. The 5.2 code + standard emerald template already do set a meta description header in the header.tpl, but this module allows for somewhat more fine grained control over the amount of data that is put in the meta description tag.

By default, the text from the "Phorum Description" setting (admin interface, "General Settings") will be used. Except on the list and read pages.

On the list page (the thread overview), the description for the forum will be used as the meta description. The description can be changed by editing the description for the forum (from the forum's settings in the admin interface).

On the message read page, an excerpt from the thread-starting message will be used as the meta description. How much of the message is used in the excerpt can be configured from the settings for this module.

Note:
Make sure that you do not have a meta description tag configured in the "Phorum Head Tags" option in the admin interface. If you do so, your page will end up with two meta tags, which might confuse search engines.

Thanks to Brian Moon for inspiring me for writing this module by publishing his template hack. (see [www.phorum.org])

Changelog:
----------

2009-10-27 v1.1.3

    - Fixed an undefined index warning.

2009-09-30 v1.1.2

    - Fixed a tiny typo in the module's info.txt that caused the module
      to not do its job. Thanks to CBiLL for the heads up.

2007-08-05 v1.1.1

    - Fixed an undefined index warning.

2007-08-05 v1.1.0

    - Made the module compatible with Phorum 5.2.

2007-03-01 v1.0.2

    - Made the meta description work in threaded mode. Thanks to
      Marjolein Katsma for the heads up.

    - Moved the default settings to their own defaults.php file.

2007-01-21 v1.0.1

    - Added newlines before and after the data that is added to the¶
      page's <head> data for a nicer look of the source code,
      as requested by Adam (user "sheik" on phorum.org).

2007-01-12 v1.0.0

    - Initial release


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 4 time(s). Last edit at 10/27/2009 11:39PM by Maurice Makaay.
Attachments:
open | download - meta_description-1.1.3.zip (4.9 KB)
open | download - meta_description-1.1.3.tar.gz (3.4 KB)
Re: Module: Meta Description
September 09, 2007 01:35AM
A small change was made to the module to prevent an undefined index warning. Thanks to CBiLL for reporting the warning message.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Meta Description
September 30, 2009 07:51AM
This module seems not to be working with the latest Phorum version because I had the Module to these settings

Maximum paragraphs 0
Maximum words 0
Maximum characters 250

And the meta tag description is going over more than 250 characters when the post is over 250.

It seem to be totally random where it cut off like between 260 to 298 even if it more than 300 characters in the post but I would have preferred it to cut off at exactly 250 characters as I set it in the module.

I did a test and set the Maximum characters to like 10 and it still remain the same as the 250 setting with 298 characters in meta description on both settings.

Could you check into this?

Thank you
Bill
Re: Module: Meta Description
September 30, 2009 07:59PM
Try again with the version 1.1.2 that I just uploaded. That should fix the issue.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Meta Description
September 30, 2009 08:58PM
Quote
Maurice Makaay
Try again with the version 1.1.2 that I just uploaded. That should fix the issue.

Yeah it fixed now and thank you so much for fixing it quick.

But one question ..

Is it possible to add one more setting to this module to limit characters of the <title> for the read page?

Some of our subject line have so many characters and are long that even I like having subject line as the <title> of the page but search engine does not take too kindly to pages with long title

Reason I know that is because I look for pages with long subject lines on search engine website and I would not find any and that pretty much the pages I would find on it are ones with short title and short descriptions, that how it lead me to discover this bug.


Thank you
Bill
Re: Module: Meta Description
September 30, 2009 09:06PM
That would not be a task for this module really. That should be a different mod, or even a template hack. Something like this in the header.tpl, before using the {HTML_TITLE} should do:

Language: PHP
<?php $title = $PHORUM[';DATA';][';HTML_TITLE';]; if (strlen($title) > 5) { $title = substr($title, 0, 5) . '; ...';; $PHORUM[';DATA';][';HTML_TITLE';] = $title; } ?>


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Meta Description
September 30, 2009 09:59PM
Quote
Maurice Makaay
That would not be a task for this module really. That should be a different mod, or even a template hack. Something like this in the header.tpl, before using the {HTML_TITLE} should do:

Language: PHP
<?php $title = $PHORUM[';DATA';][';HTML_TITLE';]; if (strlen($title) > 5) { $title = substr($title, 0, 5) . '; ...';; $PHORUM[';DATA';][';HTML_TITLE';] = $title; } ?>

How do I set it to limit it to 75 characters on subject line in the title, I change the > 5 to > 75?

Thank you
Bill
Re: Module: Meta Description
September 30, 2009 10:33PM
Change both occurrences of 5 to 75, so also the one in the substr function call.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Meta Description
October 27, 2009 11:40PM
Uploaded version 1.1.3, which fixes an undefined index warning.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login