SEO plugin: a simple idea

Creating and modifying plugins.
dolbex
Regular
Posts: 22
Joined: Fri Aug 18, 2006 9:17 pm

Post by dolbex »

Gamersea wrote:There is a small bug if you don't fill in any description or I have update the serendipity_event_metadesc.php file wrong.

bug:
Warning: implode(): Bad arguments. in /You/may/not/see this directory/html/plugins/serendipity_event_metadesc/serendipity_event_metadesc.php on line 109

Edit however I don't know that much of it (yet) but the problem is in this rule:

Code: Select all

        $meta_keywords = implode(',', $this->extract_keywords($GLOBALS['entry'][0]['body']));
Agreed. If the keywords is left blank keywords are def. not being created via the body of the text.

Also, is there any way we can change this so that it will use default keywords for any other page?
dolbex
Regular
Posts: 22
Joined: Fri Aug 18, 2006 9:17 pm

Re: SEO plugin: a simple idea

Post by dolbex »

garvinhicking wrote:Hi!

Great, that's a good suggestion. I just built a plugin to do this. It also allows you to define meta-tags per entry, and only if those are not set it will fetch them using your functions.
Another observation. Is there a way to build this in a little deeper into the engine so that we can utilize Windows Writer's tagging system to input the keywords?
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

What's Windows Writer? How does it input keywords?

I've corrected the plugin so it doesn't emit this error. However, this could only occur when no keywords were specified, and no keywords are tagged in the entry body. Make sure you've defined keyword tags in the plugin configuration, and the entry body contains words tagged with those tags.

(The pellet with the poison is in the vessel with a pestle...)

Since the "warning" message no longer occurs, the only way to know whether you've got keywords or not is to examine the page source. It should contain a meta description and meta keywords. If the entire meta keywords line is missing, no keywords were found.
Judebert
---
Website | Wishlist | PayPal
dolbex
Regular
Posts: 22
Joined: Fri Aug 18, 2006 9:17 pm

Post by dolbex »

judebert wrote:What's Windows Writer? How does it input keywords?
You can find that here:

http://windowslivewriter.spaces.live.com/
judebert wrote:Since the "warning" message no longer occurs, the only way to know whether you've got keywords or not is to examine the page source. It should contain a meta description and meta keywords. If the entire meta keywords line is missing, no keywords were found.
Seems like an awfully difficult procedure to produce something so important.... *sits and thinks*
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

That's just the procedure to check. To make the keywords, you just specify in the plugin which tags are for keywords and then use those tags in the entry body. For instance, if you define "b,i" then all bold and italic words in the entry body should become metadata keywords.

If you fail to define any, though, you won't get an error message any more. You'll have to view source if you want to check.
Judebert
---
Website | Wishlist | PayPal
dolbex
Regular
Posts: 22
Joined: Fri Aug 18, 2006 9:17 pm

Post by dolbex »

judebert wrote:That's just the procedure to check. To make the keywords, you just specify in the plugin which tags are for keywords and then use those tags in the entry body. For instance, if you define "b,i" then all bold and italic words in the entry body should become metadata keywords.

If you fail to define any, though, you won't get an error message any more. You'll have to view source if you want to check.
I wish it was a little simpler. Consider this:

Lets just say I want 30 keywords no matter what. (I'm just using 30 as an arbitrary number) I can generate those keywords using 3 methods:

Keyword tagging (via when I post an article)
scripting (via my bold, italic, etc tags)
or by title and popular words in the body

Use the defined keywords 1st, then any scripted ones, finally to fill the gaps (or completely populate if nothing was entered the 1st two ways), use every word in the title along with the most popular words in the body.

If you really wanted a failsafe, you could define what the "default" words were if the body was only a sentence or so (this happens on photoblogs, quickposts, etc)

Just thinking out loud....
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Ok, I'm looking at this from the perspective of trying to improve the xmlprc plugin, from this post.

I have to say that I am really confused...
So, what we have is a metadesc plugin which has user defined "keywords" in the configuration, and then change the output of a page based on if those keywords exists (ie, it adds the meta-description). So this means keywords are pre-defined in for the entire blog...

Right?

And dolbex, your problem is that you want to add "keywords" at a post level... Or at least be able to update the keyword list when a post is added, right?

So one solution is keywords added to a post could be appended to the configuration string? (note, this is really likely to slow down your blog in the long run, since every post would be parsed though the ever growning list of keywords...)

Or does it make more sense to try to roll this into the freetag plugin, so that users can define a small list of standard words which are always parsed for metadesc, but so that users can also define tags which are used in the metadesc?

I think you could add a hook to the freetags plugin which just returns the tags for an entry (using getTagsForEntry). Then metadesc can call the hook, and toss those tags into the keyword list.

Then, from an xmlrpc perspective, we just have to add the keywords to the freetags plugin (which is actually already happening).
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Ok, after playing with the metadesc plugin, I think it just makes sense to add the xmlrpc tags to the META-Keywords list, since they seem to be on a per-entry basis.

I'll take a look at that.
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Patch has been commited to CVS (withc a version increment to 0.5). This patch adds: backend_delete_entry, xmlrpc_deleteEntry, xmlrpc_updertEntry, and xmlrpc_fetchEntry hooks

The plugin should now add mt_keywords to the entryproperties table under "meta_keywords" when a post is created using XML-RPC.
dolbex
Regular
Posts: 22
Joined: Fri Aug 18, 2006 9:17 pm

Post by dolbex »

mgroeninger wrote:Patch has been commited to CVS (withc a version increment to 0.5). This patch adds: backend_delete_entry, xmlrpc_deleteEntry, xmlrpc_updertEntry, and xmlrpc_fetchEntry hooks

The plugin should now add mt_keywords to the entryproperties table under "meta_keywords" when a post is created using XML-RPC.
Very awesome mgroeninger! Thanks so much. I think it will make the whole process a lot easier when publishing from a 3rd party proggie...

Thanks again!
Post Reply