The Twitter widget displays an embedded Twitter tweet, video, or timeline in a Marfeelized mobile site.
Gutenberg spots the class of the Twitter embed:
- tweet (.twitter-tweet)
- video (.twitter-video)
- timeline (.twitter-timeline)
Gutenberg then transforms it to the Marfeel version with the respective classname:
When these classes are found inside an article, the Twitter platform code (platform.twitter.com/widgets.js) is run in order to replace the elements with their embed representation.
Activation code snippet
Implementation is included in the Marfeel core and no extra code is needed. It should run automatically on demos as well.
- A querySelectorAll must be run on every article change, in order to find the Twitter widget.
- Sometimes the publisher changes the code of the Twitter embed or uses old implementations.
- In most cases the publisher doesn't need to change anything.