Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-07-13 15:00:42

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

jad_metadata

Thought it would be neat to have the use of the meta description and keywords tags in the had section again…the whole semantic web and all, you know. So I made my first plugin:

jad_metadata.txt

The tag <code>&lt;txp:jad_metadata /&gt;</code> goes in the HEAD section, and uses the excerpt for the meta-description tag and a custom field for the meta-keywords tag. By default it uses <code>custom_1</code>, but you can change that by specifying the customid parameter.

Hope it works for you, support will be spotty :)

version 10.3 (4/6/2006):

  • fixed bug where textile in excerpts was showing up in the meta tags
  • added ability to limit description to a given number of words
  • updated help section

Last edited by jdueck (2006-04-06 22:33:55)

Offline

#2 2004-07-14 00:18:40

kennethlove666
Member
From: arkansas
Registered: 2004-04-27
Posts: 107
Website

Re: jad_metadata

ok, the excerpt-as-description thing i like. but why not use <txp:meta_keywords /> and just fill in the keywords box in the advanced options on the write page?


Listen to Kenneth

Offline

#3 2004-07-14 03:10:59

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: jad_metadata

well, those keywords were originally for filtering purposes within textpattern, an additional layer of semantic connectivity between articles (as if sections and categories weren’t enough)…

but you see, I’m already using the original keywords on my site to divide articles into “volumes”. So maybe it is just an idiosyncrasy of my usage.

Offline

#4 2004-07-14 09:42:23

lee
Member
From: Normandy, France
Registered: 2004-06-17
Posts: 831

Re: jad_metadata

I’ve been using the keywords to filter the display of articles, so when I just wanted one article in a category to show up I use the article_custom tag . Is this the right use of keywords or is there a better way to get a specific article to display?
Thanks, Lee.

Offline

#5 2005-03-03 22:16:28

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: jad_metadata

Does this plugin work for anybody?

All I get is BLAH before the doctype and the meta tags empty.


BB6 Band My band
Gud One My blog

Offline

#6 2005-03-05 20:05:42

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: jad_metadata

well, it works for my site :)

how are you using the tag?

Offline

#7 2005-03-06 00:44:11

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: jad_metadata

Works nicely for me, both on RC 1 and RC 3.

The only (minor) problem – if one uses html tags in the excerpt fields, then it badly breaks the validity of a page.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#8 2005-03-06 22:26:39

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: jad_metadata

I use a php include (head.inc) at the start of each page which has the doctype, head section and then a bit more stuff.

In the head.inc I put <?php echo $metadata; ?>
In the page template I put <?php $metadata = ‘<txp:jad_metadata />’; and then include head.inc.
In custom1 I have written keyword (that’s all)
In excerpt I have written excerpt text (that’s all)

I’ve tried it without the php include but I get the same results. I really need head.inc, though.


BB6 Band My band
Gud One My blog

Offline

#9 2005-03-06 22:28:44

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: jad_metadata

I use a php include (head.inc) at the start of each page which has the doctype, head section and then a bit more stuff.

In the head.inc I put <code><?php echo $metadata; ?> </code>
In the page template I put <code><?php $metadata = ‘<txp:jad_metadata />’; </code> and then include head.inc.
In custom1 I have keyword
In excerpt I have excerpt text

I’ve tried it without the php include but I get the same results. I really need head.inc, though.


BB6 Band My band
Gud One My blog

Offline

#10 2005-03-07 03:54:42

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: jad_metadata

I don’t know how any plugin would behave when placed inside an external file and included from the page template. It seems to me that would be flirting with ‘undefined behaviour’.

Are you using any other plugins in this included file, and do they work?

Offline

#11 2005-03-07 14:44:09

jdueck
Plugin Author
From: Minneapolis, MN
Registered: 2004-02-27
Posts: 147
Website

Re: jad_metadata

phiw13 – thanks for bringing that to my attention. I’ve updated the plugin to strip out HTML & php from the excerpt before it gets put into the meta description tag.

Offline

#12 2005-03-07 18:38:36

zero
Member
From: Lancashire
Registered: 2004-04-19
Posts: 1,470
Website

Re: jad_metadata

Strange… must be me…

I’ve just tried it with the txp:zem_popup_cat plugin and it works fine. It also works fine for txp:page_title, txp:recent_articles and txp:article_custom.

So I deleted jad_metadata and then reinstalled it and now it works!

Nice plugin! And so yes, it does work from inside an include. I’ve just discovered includes. Aren’t they great?!


BB6 Band My band
Gud One My blog

Offline

Board footer

Powered by FluxBB