Topic-icon custom facebook description using graph

Active Subscriptions:

None
10 years 10 months ago #34500 by piersol
I have a portion of my k2 item template that looks like this:
<span>I'm a</span><?php echo $extrafields[16];?><span> year old</span><?php echo $extrafields[20];?> <span>hair,</span><?php echo $extrafields[14];?><span> eyes,</span><?php echo $extrafields[4];?>
			<a href="<?php echo $this->item->category->link; ?>"><?php echo substr($this->item->category->name, 0, -1); ?></a>
		<span>available for</span><?php foreach ($this->item->tags as $tag): ?>
		    <a href="<?php echo $tag->link; ?>"><?php echo $tag->name; ?>,</a>
		    <?php endforeach; ?><span>modeling jobs.</span>

Which outputs this for example:

I'm a31 year oldbrown hair,brown eyes,5' 9" Indiana Model available for pinup, alternative, lingerie, swimwear, implied, fashion, editorial, fitness, parts, retro, glamour, beauty, boudoir, runway, promotional, modeling jobs.


Can you help me understand what {jfbconnect code} to put before and after this so that this area becomes the PULLed portion into facebook likes and recommendations?

All my items in k2 have extra fields and tags complete but not all use the primary content area so this is highly desireable as it makes for a consistent presentation for every page.
The topic has been locked.
Support Specialist
10 years 10 months ago - 10 years 10 months ago #34512 by alzander
If you already have that in your template, what you'd want to do is add another block under or around that with the following:
{SCOpenGraph description=I'm a<?php echo $extrafields[16];?> year old<?php echo $extrafields[20];?> hair,<?php echo $extrafields[14];?> eyes,<?php echo $extrafields[4] . substr($this->item->category->name, 0, -1); ?> available for<?php foreach ($this->item->tags as $tag): ?> <?php echo $tag->name; ?>, <?php endforeach; ?>modeling jobs.<?php echo $tag->name; ?>}
That is basically taking the same block, removing the spans and links (which can't be in the Open Graph Description) and using the {SCOpenGraph description=xyz} tag to set it all.

Alternatively, if that block is always the beginning of an article, you can configure JFBConnect to always use the first 100 words or something like that. The above is more configurable and should work. Obviously test and let us know how it goes!

Thanks,
Alex
Last edit: 10 years 10 months ago by alzander.
The topic has been locked.