Trying to conditionally add to zone for ogp meta tags

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Trying to conditionally add to zone for ogp meta tags

Raymond Lutz
Friends:

I think my problem comes down to evaluation order.

I am trying to add property meta tags to the header to be compatible
with Open Graph Protocol, i.e. http://ogp.me so that fields are
correctly imported when people share on social media sites. I did not
notice any plugin that deals explicitly with this protocol. It seems to
be getting traction. It seems though it should be feasible to do it
using the primitives already available.

To make matters a bit more complicated, I am adding this to an included
header topic. So on all the other topics of this type, the header is
included as %INCLUDE{MediaTopicHeader}%

The section of MediaTopicHeader I am having trouble with is the second
ADDTOZONE. Everything in the first one below works okay, and the
expansion is correct in the including topic.

I tried inverting the encapsulation so that ADDTOZONE was the result of
the IF but it does not work but maybe it has to do with escaping quotes,
etc.


%ADDTOZONE{"head" text="
<meta name=\"title\"
content=\"%QUERY{"'%BASEWEB%.%BASETOPIC%'/fields.Title"}%\" />
<meta name=\"description\"
content=\"%QUERY{"'%BASEWEB%.%BASETOPIC%'/fields.Note"
format="<noautolink>$value</noautolink>" separator="" encoding="safe"}%\" />
<meta property=\"og:description\"
content=\"%QUERY{"'%BASEWEB%.%BASETOPIC%'/fields.Note"
format="<noautolink>$value</noautolink>" separator="" encoding="safe"}%\" />
<meta property=\"og:title\"
content=\"%QUERY{"'%BASEWEB%.%BASETOPIC%'/fields.Title"}%\" />
<meta property=\"og:url\"           content=\"%TOPICURL%\" />
<meta property=\"og:site_name\"     content=\"Citizens' Oversight\" />
<meta property=\"og:image\"
content=\"%QUERY{"'%BASEWEB%.%BASETOPIC%'/fields.ThumbnailLink"}%\" />
<meta property=\"fb:app_id\" content=\"citizensoversight,raylutz\"/>"}%

%ADDTOZONE{"head" text="
%IF{" '%BASEWEB%.%BASETOPIC%'/fields.MediaType ~ '*Audio*' "  then =
"<meta property=\"og:type\"  content=\"audio\"/><meta
property=\"og:audio\" content=\"%QUERY{"
'%BASEWEB%.%BASETOPIC%'/fields.MediaLink"}%\" />"}%
%IF{" '%BASEWEB%.%BASETOPIC%'/fields.MediaType ~ '*Video*' "  then =
"<meta property=\"og:type\" content=\"video.other\"/><meta
property=\"og:video\" content=\"%QUERY{"
'%BASEWEB%.%BASETOPIC%'/fields.MediaLink"}%\" />"}%
%IF{" '%BASEWEB%.%BASETOPIC%'/fields.MediaType ~ '*Article*' "
then="<meta property=\"og:type\"  content=\"article\"/>"}%
"}%

Any advice is appreciated!

--Ray



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Foswiki-discuss mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/foswiki-discuss