HTML META-Tags plugin duplicates Description and Keyword tag

Creating and modifying plugins.
Post Reply
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

HTML META-Tags plugin duplicates Description and Keyword tag

Post by vincem »

Hi,

I would like to use the HTML META-Tags plugin to generate Description and Keyword Meta tags in single entries only.

However, I want a generic set of Description and Keyword tags to appear on the main page of the blog and other listing pages.

Here's my issue: if I place these generic Description and Keyword Meta tags in index.tpl, the HTML META-Tags plugin causes duplicate tags in single entry pages. I've tried using the HTML-Head Nugget plugin to generate my generic Description and Keyword Meta tags and even placing it after the HTML META-Tags plugin in case it would check for its presence, but I still get duplicate tags.

Any suggestions would be appreciated. Maybe I'm missing something obvious...

Cheers,

Vince
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by judebert »

I don't think the HTML Meta-Tags plugin covers this specifically.

However, it would be easy enough to handle in the index.tpl. Just surround your meta information with the Smarty invocation:

Code: Select all

{if $startpage == 'true'}
...meta info...
{/if}
Then that meta info will only be displayed on the startpage. Since the plugin handles only the entry pages, there will be no duplicates.
Judebert
---
Website | Wishlist | PayPal
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by Don Chambers »

The plugin HAS default meta keyword and meta description values... The plugin will emit those defaults on all pages that entry-specific values are not specified. You do not need to provide them within index.tpl.
=Don=
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by judebert »

Thanks, Don!

Ignore my code above. Don knows more about this plugin's use than I do.
Judebert
---
Website | Wishlist | PayPal
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by vincem »

Thank you both for your replies.

Actually, Judebert's idea was exactly what I was after. Don is right, the plugin does has a default for Description and Keyword but as far as I understand, it is ONLY triggered on single entry pages IF no specific values have been entered at entry publishing time.

So I went ahead and used the code in index.tpl and it all works like a charm for my needs. I am now able to present Googlebot with my blog's official description when it comes to the home page and later different, more specific descriptions and keywords on each individual pages.

My last question would be this, and I apologize for my relative ignorance in Smarty: if in my snippet of code in index.tpl, I could check for "detailed entry" NOT being true (since that's the only mode in which the plugin will issue description and keyword tags), instead of $startpage BEING true, then I could tailor my descriptions even more (for Archives, Static pages, etc). I'm afraid, however, that I don't know what Serendipity value to check for for "single entry" for s9y... Any hints?

Also, while we're at it, where are all those Serendipity values (such as $startpage) stored, is there a single reference that I haven't found?

Thanks in advance!

Vince
vincem
Regular
Posts: 59
Joined: Sat Mar 05, 2005 6:01 am
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by vincem »

Sorry, just found it:

Code: Select all

{if $view != 'entry'}
I'll work on the details, but am still curious to know if there is one global source for all those reference values.

UPDATE: Ok, that's embarrassing: I just realized that I was using an earlier version of the plugin which didn't have the option for a default set of description and keyword. Sorry Don, you were right!

Cheers,
Vince
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: HTML META-Tags plugin duplicates Description and Keyword tag

Post by Don Chambers »

vincem wrote:Sorry Don, you were right!
:wink: That was an option I wanted myself, so I added it.
=Don=
Post Reply