Archived : Techno Babble

This is the archived version of my b2evolution code blog.
If you require any help regarding b2evolution then
visit it's support forums

You can find my current blogs here
Code : {@link : WafflesOn}
Personal : {@link : InnerVisions}

« OMG we almost have a new plugin!Widgets »

Customise your posts

Posted on 1st Aug 2007 in : Plugins & Widgets

If I waited for Scott we'd never have a writeup :|

We've had this plugin lying around for so long that we've already updated it twice and still haven't managed to do a public release ...... oooops :p Anyway welcome to the AstonishMe Custom Plugin, this plugin allows you to add all sorts of custom stuff directly from your posts giving you far more control over your blog than ever.

Wanna play with SEO?

Whilst b2evolution is a great little blogging platform, it does have a few drawbacks, one of which is the static keywords and descriptions for each blog. As you probably know, the evil google bot prefers to see keywords and description that are relevant to the content on the page at any given moment. Now you can have custom keywords and description on a per post basis, you can also control the title and even add more meta tags if you want. The title & description of the post are used when you're in single post mode ( it defaults to the stock ones if you don't have one for a post ). The keywords are used whenever the post is being viewed archives/categories/front page etc, only the unique ones are shown so you shouldn't get any duplicates.

Gimme some style

Apparently some people like to make their posts look like a tarts boudoir which, up until now, has meant that you either needed a huuuuuuuuuuuuuuge stylesheet or *shudder* you had to restrict yourself to just a few boring styles!! Now you have the ability to add post specific baubles to your blog with no fear of excessive bloat. To make things easier you can target each post specifically simply by using %post% in your class/id names. This will be replaced by am_custom_post_##_ so you can avoid conflicting classnames.

Need a script?

If you had javascript enabled, you wouldn't be reading this ;)

If you happen to be one of those people who are forever adding all sorts of javascript gimmicks so that you can amaze your visitor with some stunning new effect, assuming they have javascript enabled of course, then you're probably going to want to meander through the plugins code and change a 0 to a 1 ;). This will then allow you to either add your script in <head> or directly inside the post at the spot you type it. Fair warning though, enabling this option will allow any user with posting rights to post javascript, so be think before you enable it huh?

Enough already

I suppose it's time to tell you how to use all these new found powers huh? First off all you need to do all the usual stuff like, download the plugin, unzip it, upload it, wander into admin and install it. Unlike most of our plugins, this one also involves you ripping a couple of bits out of your skins _main.php. Don't worry though, it's fairly painless and the worst you could do is melt down your server if you delete the wrong bit huh? So, now that you're reassured, crack open your skins _main.php and delete the red bits ;)

PHP:

<span style="color:red"><title><?php </span>
      <span style="color:red">$Blog->disp('name''htmlhead'); </span>
      <span style="color:red">request_title' - '''' - ''htmlhead' ); </span>
    <span style="color:red">?></title> </span>
    <base href="<?php skinbase(); /* Base URL for this skin. You need this to fix relative links! */ ?>" /> 
<span style="color:red">    <meta name="description" content="<?php $Blog->disp'shortdesc''htmlattr' );?>" /> </span>
    <span style="color:red"><meta name="keywords" content="<?php $Blog->disp'keywords''htmlattr' );?>" /> </span>

Now what?

From now on, whenever you make a post you have the ability to customise it in all the ways mentioned above by using the following tags. For css and javascript %post% will be replaced with .am_custom_post_##_. For those of you who have been using this plugin for a bit, don't worry, all old style tags still work as well ;)

Html:

<!--title title to use -->
The title to use will be used as the pages html title in single post mode.
<!--description post description -->
The post description will be used as the pages description in single post mode
<!--keywords keywords to add -->
The keywords to add will be appended to the pages keywords. The plugin also ensures that there are no duplicate keywords
<!--meta meta tag data -->
This will add a meta tag <meta meta tag data />
<!--css custom css for post -->
The custom css for post will be output between <style> tags
<!--script javascript to add -->
The javascript to add will be output inside <head> between <script> tags
<!--js javascript to add -->
The javascript to add will be output inside your post 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.

So, now you can decorate your posts to your hearts content, let me know if you have any problems huh?
¥

36 comments

Comment by stk { @link http://randsco.com/the-tarts-boudoir } on 01/08/07
Yeah, yeah ... I :* you too.

This plugin rocks, but now I'll have to download it and install it all over again, just b/c of the %post% thing.

Last time I checked, you had a membership at http://astonishme.co.uk :|

-stk

What should we do with spammers? You want to stone them
Comment by ¥åßßå on 01/08/07
Hey pastel boy, last I looked this plugin was just waiting for the final fluffy touch :roll:

Gotta love any plugin that allows blinking text :|

¥

What should we do with spammers? You want to play with them
Comment by Gary { @link http://garysblog.co.uk } on 05/08/07
Hi Paul, I can see you have a new post, glad you found the admin/new post link at last.
Not got time to read it though, we have a table booked for tea at 8pm and must set of to go now.
I will have a good read of it another time.

TTFN,

Gz

What should we do with spammers? You want to play with them
Comment by Iskra on 02/09/07
Awesome plugin! just instaled it and trying to make it work for Haloscan comments system, but I still getting a "Illegal tag: script" error. I'm using the am_custom_post_##_ in a span tag so I don't know what I'm doing bad!

Sorry for this message, but I tried to post in the b2evolution forum and recognized my post as spam! it's very unfair!

What should we do with spammers? You want to burn them
Comment by ¥åßßå on 02/09/07
Glad you like the plugin. I'm assuming that you managed to post on the forums as I've pretty much just answered that question here

¥

What should we do with spammers? You want to play with them
Comment by JC John SESE Cuneta { @link http://gameshogun.ws/ } on 13/10/07
¥, maybe this plugin should be embedded to b2evolution v2.0? I think this is very beneficial for b2evolution itself, not just the users ;)

In case it won't be, any change you'll change it to a b2evo plugin so no more hacking?
Also a few suggestions or requests:
Instead of

<!-- stuff here -->


Why not a new "field" during post or edit-post? I think it will be easier.

More specifically, for description.. maybe instead of a separate "field", why not a new tag say:

<description> ... </description>


which we can use to enclose a portion of our post-content which will serve as the description?

Just some ideas ^_^

Regards
Comment by ¥åßßå on 13/10/07
Without it having a new hook it's almost impossible to make this 100% a plugin. The description and keywords are no problem, but the main battle is changing the title and then reverting it for the post. I'm not sure how many people actual use that lil bit of functionality apart from me though.

Prior to 1.10.x there wasn't an easy way to make the title/keywords/css/js input fields without the plugin having it's own database table, and since 1.10.x I keep forgetting to use the new hooks :P

I'm a tad adverse to using custom html tags to wrap things because they degrade badly if a plugin is uninstalled, but it could certainly be made to trigger off <!--description--><!--/description-->

I'll have to have a play around in the code to see what I can do ;)

¥
Comment by Lurker on 26/10/07
haii hOw r ya bubah??

x x x
Comment by Lurker on 28/04/08
Hi!

I'm using the plugin on b2e 2.4.0. On every post i fill the fields "Keywords" and "Description", but this tags are not used. I deleted the default tags in my template, but after publish a post, the site has no meta-tags.

I checked my table-data (_evo_item__item) and i can see the - tags there.

Something is wrong, but what?

Greetings from germany
Joerg
http://www.stundenzeiger.de
Comment by ¥åßßå on 28/04/08
Hi there,
from viewing the source of your page I can't see a single keywords/description/css/title snippet in any of your posts?

They should look something like this in page source :

<div class="bText">
<!--title Custom titles rock -->
<!--description This description was brought to you courtesy of the AstonishMe custom plugin -->
<!--keywords b2evolution, plugin, custom css, seo, keywords, description -->



¥
Comment by Lurker on 28/04/08
again: :-)

Hmmm .... the following lines are coming from the field post_content in the table evo_items__item :
<!--keywords Concord,C1,Tourbillon,Gravity --><!--description Concord - C1 Tourbillon Gravity -->

But these lines aren't in the page-code ... i'm thinking that the renderer had filtered these lines. What can i do?

If i edit the last post, the fields description and keywords in the form a filled.
Comment by Lurker on 28/04/08
Ok ... i checked something.
If i use another skin (for example http://www.stundenzeiger.de/index.php?tempskin=asevo ), then the plugin works great. :-/
So i think i should check my templates ...
Comment by ¥åßßå on 28/04/08
Cool, let me know if you still have problems ;)

¥
Comment by Lurker on 28/04/08
Ok - i have found it ... i had killed the line $Plugins->trigger_event( 'SkinBeginHtmlHead' ); from my template. :crazy:
Comment by ¥åßßå on 28/04/08
Glad you solved it ;)

¥
Comment by tilqicom on 31/10/08
¥åßßå, is this plugin necessary still with 2.4.5 ? or shall i say, would using this in addition do good ? the features sounded similar to what 2.4.5 has -assuming b2 didnt have these at the date when the post was written- .. could this actually improve further anything, i mean does it have a seo feature else than 2.4.5 has already that i missed ?

and first thing last; does it really work with 2.4.5? thanks in advance
Comment by ¥åßßå on 31/10/08
I've no idea if it works in 2.4.5 ... works in my version though .... whatever 2.4.x version it is :p

The only bit of this plugins functionality that's in 2.4.x+ is the fact that you can use javascript in your posts now ( settings allowing ) ?

If you re-read the post it should answer your seo question ;)

¥
Comment by tilqicom on 31/10/08
i ve read the post, it sounded it could do further

« Now you can have custom keywords and description on a per post basis, you can also control the title and even add more meta tags if you want. The title & description of the post are used when you're in single post mode ( it defaults to the stock ones if you don't have one for a post ). The keywords are used whenever the post is being viewed archives/categories/front page etc, only the unique ones are shown so you shouldn't get any duplicates. »

i just wanted to hear from ya, i ll give it a try asap.hope it works,i thanks
Comment by Lee Turner { @link http://leeturner.org } on 11/01/09
Hi, I just found this plugin and think it is a great idea. I have installed it and removed the red bits from my skin. I haven't yet added any of the tags to my posts but when I view a single post it seems to combine the title for the post with the title for the blog. I know I must be missing something but could you give me some pointers?

Many thanks
Lee
Comment by Lee Turner { @link http://leeturner.org } on 11/01/09
Hi again

I just made a few changes to the code and it seems to be working. The changes I made are:

PHP:

echo '<title>';
if( $this->title )
{
    echo format_to_output$this->title'htmlhead' );
} else {
    if( $disp == 'single' )
    {
        request_title' - '''' - ''htmlhead' );
    }
    else
    {
        $Blog->disp('name''htmlhead');
    }
 
}
echo '</title>'."\n";


I am not sure why it wasn't working for me as I couldn't find anyone else having this problem. I forgot to mention this but I am running b2evo 2.4.5.

Many thanks
Lee
Comment by Lurker on 11/01/09
Sorry for the large number of comments - a change to the code I did before so it works properly:

PHP:

echo '<title>';
        if( $this->title )
        {
            echo format_to_output$this->title'htmlhead' );
        } else {
            request_titlearray(
                'auto_pilot'      => 'seo_title',
            ) );
        }
        echo '</title>'."\n";
Comment by ¥åßßå on 12/01/09
Hi Lee,
You'd be better off by downloading the latest version of the plugin ( 1.9.1 ). If you have bopit installed then you'll see a download link in your admin. If not then you can download the latest version from here AM Custom, just hit the tacky lil' icon that looks like a diskette.

I'll update the download link in my post ;)

¥
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
Hi ¥åßßå

Many thanks for that but It doesn't seem to work for me. I have installed the new plugin and I am no longer getting my custom titles (the normal title is there) and I no longer get any keywords or description. I noticed the new fields on the edit post screen which is a fantastic addition so I assumed I needed to enter the data there instead of the old in the post itself?

Cheers
Lee
Comment by ¥åßßå on 12/01/09
Damn, you really did have an old version!

I *thought* the new version pulled the old versions data into the boxes though. Can you post a sample of one of your current keywords/descriptions stuff that you have in a post?

The new boxes are ok, but I really need to tart them up a smidge ;)

¥
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
When I installed the new plugin it did pull my custom title into the new box but it just didn't seem to display it when I loaded the blog post.

For this post:
http://leeturner.org/index.php/2007/09/05/twitterlution?blog=11

I have the following custom data:
Title : Twitterlution - Update twitter when you post to b2evolution
Keywords : twitter, b2evolution
Desc : Update twitter when you post to b2evolution


This post:
http://leeturner.org/index.php/2007/09/13/twitter_highlight?blog=11

Has the following custom data:
Keywords : twitter, highlight
Desc : Twitter Highlight highlights @replies to you on the twitter web interface

The rest of the posts on my blog have no custom data at all

Thanks for your help

*edit*
Made your urls real links ( you can use <a> in comments here ;) )
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
Hang on, have I misunderstood what this is supposed to be doing? The description I have entered seems to be updating the long description that is displayed on the right sidebar of my blog. Is this the expected behaviour?

Lee
Comment by ¥åßßå on 12/01/09
Oh yeah, that's a side effect of the new plugin ( only happens on single post pages )

The main problem is that the instructions above are pretty much as old as the zip they linked to :p

Your skins _html_header.inc.php just needs the title removing for the new version to work :

PHP ( /skins/your-skin/_html_head.inc.php ) :

<head>
    <?php skin_content_meta(); /* Charset for static pages */ ?>
    <?php $Plugins->trigger_event'SkinBeginHtmlHead' );
    add_headline'<link rel="stylesheet" href="/skins/tacky3/blogrum.css" type="text/css" />' );
    /* ?>
    <title><?php
        // ------------------------- TITLE FOR THE CURRENT REQUEST -------------------------
        request_title( array(
            'auto_pilot'      => 'seo_title',
        ) );
        // ------------------------------ END OF REQUEST TITLE -----------------------------
    ?></title>
    */
    ?>
    <meta name="description" content="<?php $Blog->disp'shortdesc''htmlattr' ); ?>" />
    <meta name="keywords" content="<?php $Blog->disp'keywords''htmlattr' ); ?>" />
    <?php robots_tag(); ?>


¥
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
Ah, OK I see what it is doing now. Pretty clever actually and no bad thing that the long desc is updated on the front end. That solves one problem :-) The only other thing left is the custom title. The title was already removed from my skin as per the old instructions so I am not sure why that part isn't working :-(

Lee
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
Think I have it working now. I removed the false from the if :

PHP:

echo '<title>';
if( $this->title )
    echo format_to_output$this->title'htmlhead' );
else
    request_titlearray'auto_pilot' => 'seo_title' ) );
echo '</title>';


The if used to read :

PHP:

if( false && $this->title )


Cheers
Lee
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
OK, not quite there :-) When I look at the main blog page (not a single post) the keywords seem to be a combination of all the keywords (even the ones I set for the individual posts):

twitter,highlight,b2evolution,plugins,php,java,development"

The keywords I have set for the blog in the admin console are:

b2evolution, plugins, php, java, development

Cheers
Lee
Comment by ¥åßßå on 12/01/09
Hmmm, wonder where the false came from :P

The behaviour with the keywords is what it's coded to do, it does make sure that there are no duplicates.

¥
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
OK, thanks for that. I take it that this means over a period of time using custom keywords for posts, the keywords for the main blog will just keep getting bigger and bigger ?

Do you know if it is a good idea to have loads of keywords on a page - even if it is the main blog page and not a single post?

Many thanks for your help
Lee
Comment by ¥åßßå on 12/01/09
The keywords are only taken from posts that are actually on the page so unless you use loads per post, or have loads of posts per page then you shouldn't have a problem.

I was fairly certain it also had a cutoff limit of 100 keywords, but that was either a dream or a previous incarnation. I'll probably add it in when I get round to recoding the admin area

¥
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
Although this is an interesting article:

http://searchenginewatch.com/2167931

keywords not really supported by most crawlers now. From the article:

Inktomi says that you should include up to 25 words or phrases, with each word or phrase separated by commas. More advice from Inktomi can be found on its Content Policy FAQ.

FYI, in the past, when the tag was supported by other search engines, they generally indexed up to 1,000 characters of text and commas were not required.

I guess the number of keywords on the main blog page are of little consequence.


Cheers
Lee
Comment by Lee Turner { @link http://leeturner.org } on 12/01/09
OK, taking the keywords from the posts on the page is a great idea. I shouldn't have doubted you :-)

Thanks for all your help.

Lee
Comment by ¥åßßå on 12/01/09
Very few search engines pay attention to them nowadys, but as long as they're relevant I use them.

You can limit the results to 100 keywords, or 25 or whatever by amending this line in the plugin ( or just hit the download link again and it'll reflect the change )

PHP ( _am_custom.plugin.php ) :

$this->keywords implode','array_slicearray_unique$this->keywords ), 0100 ) );    // lets avoid duplicate keywords


¥
Page archived : 26th Feb 2010
 

X