Zuletzt aktualisiert am

Publii Tricks: Embed tweets with user permission via

Tweets can be embedded easily with Publii, but with the visitor's permission, this only works via iframe, which Twitter does not support. However, this is still possible with the Twitter proxy Twitframe.

Youtube videos, for example, can be configured in Publii to load only when the visitor allows the functionality cookie:

This is done under Site settings > Privacy Settings.
Otherwise, the visitor will only see a placeholder with a description and a button to unlock the video:

To implement this principle with tweets as well, embedding codes with iframes are needed, but these are not supported by Twitter. If the standard embed code from Twitter is used, the tweet loads in any case - without the visitor's permission.
Twitframe works as a proxy and generates Twitter iframes as a service, so to speak. For this, only the URL of the tweet must be inserted in the embed code of Twitframe:

<iframe border=0 frameborder=0 height=250 width=550

... is changed to:

<iframe border=0 frameborder=0 height=250 width=550

Voilà, tweets can now be bound to the functionality cookie, for example.