Meta description from page part

I would like to insert a meta description into my pages. This would
be of the form:

I realise that it would not be correct to use the following construct:

Is there any way to insert the output from a radius tag into the
attribute (in this case content="") of a tag?

Another approach, I suppose, would be to define a custom radius tag
for the purpose. An example usage being:

<r:meta name=“description” part=“meta_description” />

which could output:

Am I thinking along the right lines? Has anyone already written an
extension which achieves this, or should I dive right in?

Thanks,

Drew

I have a really “dumb” (as in simple) extension that adds description
and keywords Radius tags and fields on the Page model. If you like, I
could open-source it.

Sean

I realise that it would not be correct to use the following construct:
<meta name=“Description” content=“<r:content part=“meta_description””>

You can actually use that construct, just be sure to close the
<r:content> tag.

Although Radius’s documentation (http://radius.rubyforge.org/) does
not
say it explicitly (AFAIK), the current Radius implementation allows
this.

I remember that few months ago i stated the opposite in this list, i
was
wrong.

/AITOR

Although Radius’s documentation (http://radius.rubyforge.org/) does
not
say it explicitly (AFAIK), the current Radius implementation allows
this.

Are you sure? I can’t seem to make it work. I’ve tried this:

 <meta name="description" content='<r:content

part=“meta_description”/>'/>

and also this (swapping single and double quotes):

 <meta name="description" content="<r:content

part=‘meta_description’/>"/>

Both create the following output:

Am I doing it wrong?

Drew

I have a really “dumb” (as in simple) extension that adds description
and keywords Radius tags and fields on the Page model. If you like, I
could open-source it.

That would be great. Do give us a shout if you find the time to do
that. In the mean time, I might have a go at it myself. It would be
my first Radiant extension, and it sounds suitably easy.

Thanks

Drew

I tried your example below and it works for me. Check:

  • that the page part exists
  • that you clear the cache before testing your changes

/AITOR

On 31 Oct 2007, at 10:40, Aitor Garay-Romero wrote:

I tried your example below and it works for me. Check:

  • that the page part exists

Doh! This was my problem. I was testing on a page where I hadn’t
added the page part.

Thanks for your troubleshooting!

Now to the matter of whether Radius should allow this. I had assumed
it would not be possible, because code such as

is not valid XML. One of the things I like about Radius, as compared
with Liquid layouts for e.g., is that it uses tags which a text
editor with HTML syntax highlighting can recognise. I presume that
this is deliberate. A construct like the one above is evidently
useful, but it breaks this XML namespace. So doesn’t that go against
the purpose of Radius? Any thoughts?

Drew

Hi,

Reviving this old thread.

On 30 Oct 2007, at 19:34, Sean C. wrote:

I have a really “dumb” (as in simple) extension that adds description
and keywords Radius tags and fields on the Page model. If you like, I
could open-source it.

I’ve had a go at this myself, and wanted to compare notes with you.
Here is the description of what my tag does:

Usage is similar to the @<r:content />@ tag, with @inherit@ causing
the parent page part to be used if this page does not have one. By
default, this is set to true.

Only suitable for use in @@ section of a document.

Usage:

I also wondered about making it strip the length of the content
attribute to 200 characters (configurable), as this is the upper
limit recommended by search engines. Here is a link to the article
that got me thinking about this in the first place: http://
www.seobook.com/video-optimizing-meta-description-tags-google

It makes for a pretty lame extension by itself, so I wondered whether
it might be considered for the standard tags? Once I’ve written some
tests…

Any thoughts?

Drew