[pmwiki-devel] Insert just after body

Petko Yotov 5ko at 5ko.fr
Thu Feb 17 23:58:01 PST 2022


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



More information about the pmwiki-devel mailing list