AM Custom Plug-in

2nd Feb 2006 ¥åßßå
Introduction

Topic: [keys] [CSS] [Improving b2evo] [SEO] [JavaScript][/keys]
Versions: [keys][1.8][/keys]

 

Gentlemen, Optimize Your Search Engines!

noteInformation: This plugin is AM Update enabled. This ensures that you always have the latest version of the code installed on your blog

If you have even the slightest interest in SEO then you may have realized that your b2evolution blog suffers a major flaw - your "description" and "keyword" meta tag content is identical for every single page. (G'won ... have a look)! For White-hat SEO purposes and to be semantically correct, the keywords, description and title should reflect the content of your page, whether you're looking at five disparate posts or one, in single-view mode. In other words, the content in these tags should change!

If you blog about your Persian Cat winning the National Cat Show, but your blog is predominantly about computer programming, it doesn't make much sense to have keywords like "PHP, JavaScript, XHTML, CSS, Perl, C++" when someone is viewing the article about your precious feline, does it?

The "AM Custom Plug-in" allows your tags always reflect your post content. It does this by allowing you to add a post-specific title, description and/or keywords. However, it goes a couple of steps farther, by concatonating post-specific keywords, when more than one post is viewed at a time. It also removes duplicate keywords (something Google doesn't like and bans sites for doing). It doesn't end here, as this plugin also lets you add more meta tags (whichever you might want to add) directly from your posts!

Post-specific CSS Anyone?

Until now, if you've wanted to add one-off styling to your posts, you've had only two choices: put it in your skin's CSS file and load it regardless if the post is being viewed or not -or- add it in-line (mind you, you first have to hack _formatting.php to allow 'style' as a core attribute). Neither are ideal. The first bloats your CSS file and the second undermines the whole point of a CSS file and doesn't allow you to use the pseudo-class ":hover".

Here's a demonstration! If you "view source", you'll see the class name "am_custom_demo". It'll only show if and when THIS post is shown. (Check it out). ;)

No longer! The "AM Custom Plug-in" allows you to put post-specific CSS directly into a post. It'll only load the CSS into the <HEAD> whenever that post is displayed. What could be better than that?

How About a Bit of Milk in Your JavaScript?

That's right! The "AM Custom Plug-in" even lets you add JavaScript, directly in your b2evolution posts. It's a popular request on the b2evolution forums and we're pleased to let you know that it can be done with this plugin.

Want it? Read on for install and usage instructions ...

Install and Information

To make the plugin work properly just delete the bits in red in your skin

[color=red]<title><?php[/color]
	[color=red]$Blog->disp('name', 'htmlhead');[/color]
	[color=red]request_title( ' - ', '', ' - ', 'htmlhead' );[/color]
[color=red]?></title>[/color]
<base href="#" data-code="?php skinbase(); /* Base URL for this skin. You need this to fix relative links! */ ?>" />
[color=red]<meta name="description" content="<?php $Blog->disp( 'shortdesc', 'htmlattr' );?>" />[/color]
[color=red]<meta name="keywords" content="<?php $Blog->disp( 'keywords', 'htmlattr' );?>" />[/color]
How to use the tags

The tags to use are fairly simple, and pretty self explanatory :-

<!--title [i]title to use[/i] -->
The [b]title to use[/b] will be used as the pages html title in single post mode.
<!--description [i]post description[/i] -->
The [b]post description[/b] will be used as the pages description in single post mode
<!--keywords [i]keywords to add[/i] -->
The [b]keywords to add[/b] will be appended to the pages keywords. The plugin also ensures that there are no duplicate keywords
<!--meta [i]meta tag data[/i] -->
This will add a meta tag <meta [b]meta tag data[/b] />
<!--css [i]custom css for post[/i] -->
The [b]custom css for post[/b] will be output between <style> tags
<--script [i]javascript to add[/i] -->
The [b]javascript to add[/b] will be output between <script> tags
WARNING : This will allow any user with posting rights to post javascript, it's disabled by default. To enable javascript you need to manually change the setting in the plugin code.
 
 
 
 

Comments

Anonymous
23rd Jul 2006
One thing I noticed, when using this plugin on my own pages, was that any SEO checking tool complained when using custom [titles]/[descriptions] ...

Reason?

There's a certain maximum # of characters for both these meta tags ... beyond this and they cease to be effective SEO tools.

I use the CSS part ALL THE TIME, though. I've also been meaning to test/use the javascript bit too, but so far, haven't the need.
 
Anonymous
23rd Jul 2006
I can cut the description/title off at ##chars (setting in admin) if that makes any difference? (of course, that means I'll have to detect the current pages b2evo title/description to make it work properly) but the way I see it is that it's a user thing (personally I never use any of this plugins ability :p)

¥
 
Anonymous
25th Sep 2006
Well, then yer a fool, because the custom CSS rocks. And now that you've changed the behavior for title, description and keywords ... the rest rocks too!
 
Anonymous
25th Sep 2006
lol, arse :|

¥
 
Anonymous
26th Sep 2006
OKAY ... I don't have a lot of time for this, as the Oop's dinner is nearly up and the cat is hounding me for food too.

There *appears* to be a problem with the custom plugin. It's not inserting title, description &/or keywords for disp=comments; disp=contact (my personal one) or ANY of the disp=options.

LOL ... I have to live with a SiteScore of 9.2 till it's sorted. :|

Hopefully, I'll get a moment to look deeper, but I thought you'd want to know.

HMMM ... this doesn't look good (it's #2 I'm on about, but what are the other ones?) :o LOOK HERE
 
Anonymous
26th Sep 2006
FFs ... I can't look into it further. :|

My host is so screwed that I cannot connect via FTP (critical xFer errors + disk full msgs). I cannot even begin to test possible solutions.

Was thinking that
function SkinBeginHtmlHead( $params = array() )
{
global $MainList, $Blog, $disp;

if ( !isset( $MainList ) [color=red]|| !isset($disp)[/color] ) return;


Might do it ... but I can't test. :|

GOD ... I need a new hosting server.
 
Anonymous
26th Sep 2006
Alright ... looks like it needs more logic, as $disp="posts" for the $MainList dealie and other things (some of which we may not know?). It's those "other things" that aren't getting the title/descr/keywords added.

I've had way too much wine to sort this out in my mid-packing, pre-moving, post-Oop kind of day. :ss

Anyway ... a bug that needs squishing. :p
 
Anonymous
26th Sep 2006
Hopefully that's cured the keywords bit for disp options

Cured some of the validation errors (rest are caused because you're validating a members only blog ;) )

I've not updated the zip (yet) until you're happy that it works ;)

¥
 
 

Recent Comments

     
     

    Archives