Forums | Mahara Community

Pedagogy /
Pinterest in Mahara


Anna Greenhill's profile picture
Posts: 29

14 September 2016, 4:09

Hi, 

Can you embed Pinterest boards into a Mahara page? I have tried embedding the link and embed code using the external media option but no joy! 

Any help would be gratefully received. 

Thanks, 
Anna 

Newman University, Birmingham. 

Kristina Hoeppner's profile picture
Posts: 4717

14 September 2016, 17:00

Hello Anna,

Pinterest doesn't provide a normal embed code like many other services. It looks very different and also requires that a script is added to the body of a page. The script would call the pin and include in the page as you only specify the URL for the pin but nothing else like usually. I couldn't get it to work with Embedly either because Pinterest revoked access to its API: https://blog.embed.ly/pinterest-a067705d3d13#.wt839xnhl I suspect that this might also prevent us from creating a custom filter for Pinterest. When I try creating an Embedly Card, it doesn't show the pin but still only the link to the Pinterest pin.

Cheers

Kristina

 

For reference, the embed code looks like the following for a pin:

Copy and paste this code into your page where you want your add-on to appear:
<a data-pin-do="embedPin" href="https://nz.pinterest.com/pin/36591815696169977/"></a>
Don't forget to include pinit.js once per page, right before the closing </BODY> tag.
<script async defer src="//assets.pinterest.com/js/pinit.js"></script>
Aaron Wells's profile picture
Posts: 896

15 September 2016, 11:21

To expand on what Kristina said, here's the link to Pinterest's own documentation about embedding Pinterest boards: https://developers.pinterest.com/tools/widget-builder/?type=board&boardHeight=240&boardWidth=400&imageWidth=80&template=square

It won't work with Mahara's "external media" block because it uses an <a> tag, not an <iframe>. But you could put that <a> link into a Text or Note block.

It also requires a Javascript file to be loaded on the page. Pasting the <script> tag into a Text or Note will not work, because Mahara strips out all Javascript from text entered by users, for security reasons. However, you might be able to get that to work by putting the necessary <script> tag into "$cfg->additionalhtmlfooter" in your site's config.php file. (See htdocs/lib/config-defaults.php for documentation of the $cfg->additionalhtmlfooter option.) That will cause it to be loaded on every page in your site.

Cheers,

Aaron

3 results