[pmwiki-devel] Insert just after body

2 views
Skip to first unread message

Simon

unread,
Feb 18, 2022, 12:42:23 AM2/18/22
to PmWiki Devel Mailing List
I'm looking to embed a plugin,
and the instructions suggest that
Include the JavaScript SDK on your page once, ideally right after the opening body tag.

Are there any hooks to do this, or suggestions for the best way I can do this

nā mihi

Simon

Petko Yotov

unread,
Feb 18, 2022, 2:58:50 AM2/18/22
to Simon, PmWiki Devel Mailing List
I thought this sounded familiar:


https://www.pmwiki.org/pipermail/pmwiki-devel/2021-September/002428.html

I would again recommend the iframe approach, instead of loading the
script SDK in your skin template. Browsers treat cross-origin iframes
with more suspicion and restrictions, and it is a little better for
privacy, not only because the iframe has restricted access to the
website and visitor, but also because Facebook's scripts and tracking
are only loaded on certain pages, not on all your pages.


I now see you can embed a facebook post frame with Ape
(https://www.pmwiki.org/wiki/Cookbook/Ape).

Rename the file pub/ape/ape-local-sample.js to ape-local.js if you
haven't already.

Add this to the bottom of the file ape-local.js :

uAPErx.push([/^(https:\/\/([-\w]+\.)?facebook\.com\/[-\w\/.]+)$/,

'https://www.facebook.com/plugins/post.php?href=$1&width=340&small_header=true&adapt_container_width=true&appId']);


Then in the wiki page, use something like this:

%embed width=340px height=500px%
https://www.facebook.com/TararuaTrampingClub/posts/5045130182204944 %%


Or, if you want to have a shortcut, add to config.php:

$WikiStyle['embed-fb'] = array(
'class' => 'embed',
'width' => '340px',
'height' => '500px',
);

Then in the wiki page, use:

%embed-fb% fb-post-URL %%

This sets the frame dimensions to 340x500 pixels, what is defined in the
demo/docs on FB. But text length of every post is variable, and you may
want to change it. You could do for example:

%embed-fb height=400px% shorter-post %%

or:
%embed-fb height=600px% longer-post %%

Petko

On 18/02/2022 06:40, Simon wrote:
> I'm looking to embed a plugin,
> and the instructions

> <https://developers.facebook.com/docs/plugins/page-plugin/>suggest that


> Include the JavaScript SDK on your page once, ideally right after the
> opening body tag.
>
> Are there any hooks to do this, or suggestions for the best way I can
> do
> this
>
> nā mihi
>
> Simon

_______________________________________________
pmwiki-devel mailing list
pmwiki...@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply all
Reply to author
Forward
0 new messages