Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

New MetaManager Module - Automate your MetaDesc & Keywords


Go to End


12 Posts   6447 Views

Avatar
Martijn

Community Member, 271 Posts

21 July 2009 at 4:53pm

Edited: 21/07/2009 5:10pm

Coming from a Joomla background, I needed something more flexible and easier to maintain. Silverstripe seems to fit those needs quite well.

This is my first module build for Silverstripe. I wanted to autopopulate my MetaDescription and MetaTitle fields, based on the contentfield and added some more features.

Features
* Set Metadescription with the first lines of your content
* Set Metakeywords ordered by keyworddensity of your content
* Exclude words, set amount of keywords and set minimal wordlength
* Set Metatitle with Title (optional)
* Disable the popup wich asks if you want to change the urlsegent when you change your page title
* Hide the extrameta field

You can set all options in the _config.php file.
The module adds a checkbox above the Content field, so you can bypass the Meta update function on save. Set default state also in config.

Improvements or comments?
Please post them here!

Avatar
Martijn

Community Member, 271 Posts

22 July 2009 at 4:26am

Edited: 27/07/2009 3:24am

I updated the metamanager with more options.

Changelog
*Updated disable_update_url so it does alter the URLsegment without the Confirm dialog. SS does fire a 301 Permanently Moved header on url change.
*Added option to choose wether to update the URLsegment automaticly or not.
*Added custom UpdateURL.js for autoupdate URLsegment without Confirm dialog.
*Added option to select wich metafields to update.
*Added option to hide the checkbox.
*Added option to select the position of the update checkbox.
*Added option to show wich metafields will be autoupdated in checkboxlabel.
*Added option to disable the module without removing the module from the site.
*Added option to limit the MetaDescription Length.
*Added translationstring for the Update Meta-data checkbox.
*Added English and Dutch language files.

All options can be set in the _config file.

Please feel free to comment.

Avatar
Kalileo

Community Member, 127 Posts

23 July 2009 at 2:58pm

Yeah, such a module can be really helpful and time saving. Thanks.

Avatar
Martijn

Community Member, 271 Posts

23 July 2009 at 10:46pm

Hi Kalileo,

Your welcome, Hope it can be of use!

If you find anything strange let me know.

Avatar
Juanitou

Community Member, 323 Posts

31 July 2009 at 5:47am

Edited: 31/07/2009 5:49am

Hi Martinj!

That's a really nice idea. There is at least a problem: entities. For example, in a French page containing the word société the MetaDescription field will show société and the list of keywords could include eacute (I don't understand why).

I thought that decoding entities would be a straightforward task, even for a lame PHP coder as me, and it was the case for the line 279 of MetaManagerDataDecorator.php:

$this->owner->MetaDescription = html_entity_decode(strip_tags($this->owner->Content), ENT_COMPAT , 'UTF-8');

Now the MetaDescription is nicely showing all special chars. But if I change in the same way the line 325, in the function calculateKeywords(), the result is a blank keywords field in the CMS and a wrongly encoded <meta name="keywords" …> field in the page's code.

I don't understand why this is not working, why it's not showing the keywords in the CMS but publishing the meta tag, but wrongly encoded. Sorry for not being more helpful.

Best regards,
Juan

Avatar
Martijn

Community Member, 271 Posts

1 August 2009 at 1:05pm

Hi Juanitou,

Thanks for reporting.
I will check it out!

Avatar
Juanitou

Community Member, 323 Posts

22 October 2009 at 5:25am

Hi!

The solution I’ve found needs to include a str_word_count_utf8() function instead of str_word_count() and using mb_convert_case() instead of strtolower(), all this in your method calculateKeywords(). I don’t know if it fits every config, but it works for me. File attached.

Hope it helps,
Juan

Attached Files
Avatar
steve_nyhof

Community Member, 224 Posts

6 November 2009 at 1:21pm

How can I set it so that the Navigation is also auto updated?

Go to Top