HTML META-Tags plugin is cutting the text

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
aschlemmer
Regular
Posts: 70
Joined: Fri Feb 23, 2007 6:13 pm
Location: Freiburg/Germany
Contact:

HTML META-Tags plugin is cutting the text

Post by aschlemmer »

Hi all,

I'm using the HTML META-Tags to use the entry title as meta description.
Unfortunately, the text is cut inside the automatic generated meta tag:

Code: Select all

 <meta name="description" content=""Gehirn unter Drogen" nennt sich die heutige neurologische Entde" />
because it's not using the h2-tag that I defined in the HTML META-Tags plugin settings.

Would it be better to use a kind of custom fields for this purpose?

And: It talks about using it on single-entry pages, in fact it appears on the frontpage, too.

What is the best way to generate entry-specific descriptions and keywords, any idea?

Thanks in advance
Achim
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

I haven't done much with the custom fields, but it would be a good way to go. Create a custom field called "meta", for example. Then use this Smarty, which inserts the custom meta information on only single-entry pages:

Code: Select all

{if $is_single_entry and isset($entry.properties.ep_meta)}
<meta name="description" content="{$entry.properties.ep_meta} "/>
{/if}
That also checks for the existence of a meta property, but I'm not so certain of its syntax. If it fails for you, try this instead, which provides a default value when the meta property is not set:

Code: Select all

{if $is_single_entry}
<meta name="description" content="{$entry.properties.ep_meta|default:'no description provided'} "/>
{/if}
Judebert
---
Website | Wishlist | PayPal
aschlemmer
Regular
Posts: 70
Joined: Fri Feb 23, 2007 6:13 pm
Location: Freiburg/Germany
Contact:

Post by aschlemmer »

Thanks, Judebert,

this was exactly what I intended to do if there's no other way to manage that.

I will try this around the holidays.

Happy Easter!
Achim

Update: It works, thank you! (see also my follow-up questions if you like)
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Re: HTML META-Tags plugin is cutting the text

Post by judebert »

aschlemmer wrote: Unfortunately, the text is cut inside the automatic generated meta tag because it's not using the h2-tag that I defined in the HTML META-Tags plugin settings.
This bit is confusing me a little bit. I understand that you're using the meta tag plugin, and that you've defined H2 as the tag for the plugin to pull meta info from. Why does it get cut? Is it a problem with the plugin, or a problem with the HTML?
Judebert
---
Website | Wishlist | PayPal
Post Reply