Feed Custom Field into Meta Tags

spikerb

Joined: 2009-09-09
Posts: 5
Posted: Wed, 2009-09-09 18:41

I'm using the Keyword Album Links block as a method for users to browse similar images. I'd prefer to trim this list down and not include all the tags that I want for each individual photo in the meta data. Therefore I'm trying to figure out how I can feed the content of a Custom Field (field named "Tags") into the meta data instead of the keywords.

Does anyone know what I would put in the place of <meta name="keywords" content="{$theme.item.keywords}, (found in the head content of Theme.tpl) that would display my custom fields for the image as meta tags?

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 17302
Posted: Thu, 2009-09-10 00:43

Here you can get a specific custom field
http://gallery.menalto.com/node/85470#comment-299820

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments
spikerb

Joined: 2009-09-09
Posts: 5
Posted: Thu, 2009-09-10 07:00

Thanks Dave, this worked perfectly! :-)

For those interested in doing this, here are the changes made to the Theme.tpl head content...

First, place this line somewhere above where the meta data begins...

Quote:
{g->callback type="customfield.LoadCustomFields" itemId=$item.id|default:$theme.item.id}

Then, replace the meta name "keywords" tag with the following... where "my_field" is the name of your custom field. Note: leave no spaces in the field name.

Quote:
<meta name="keywords" content="{if !empty($block.customfield.LoadCustomFields.fields.my_field)}{$block.customfield.LoadCustomFields.fields.my_field}{/if}" />

Login or register to post comments
floridave
floridave's picture

Joined: 2003-12-22
Posts: 17302
Posted: Thu, 2009-09-10 13:42

Great, thanks for sharing what you did for others.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

Login or register to post comments