Embed tweet in a text

Hi,
I would like to embed a tweet in an article content type.
I used the link provided by Twitter to integrate tweets on a page (https://publish.twitter.com/) but it doesn’t display properly. I would like to have the tweet fully displayed but not as quote (like below).

Main thanks,
Best regards,
Antoine

Hi Antoine

You are seeing things as a quote because the publish.twitter.com service automatically outputs your tweet inside a <blockquote> tag. Additionally, the design of the actual embedded tweet relies on the class="twitter-tweet" part of the output. You might have some luck with this module: https://www.drupal.org/project/twitter_embed.

All the best!

Hi Joachim,

Thanks for your answer. The module isn’t really what I want.

I have copied the code from a tweet embedded on the BBC website and pasted it in a Drupal text box and it works but with display problem. Could you please advise me for the “height” issue?

Cheers,
Antoine

(it seems I cannot paste code here so I have removed the <>)

iframe allowfullscreen=“true”
allowtransparency=“true”
data-tweet-id=“1445771738290143247” → Replace with the Tweet ID
frameborder=“0”
id=“twitter-widget-0”
scrolling=“no”
src=“https://platform.twitter.com/ embed/Tweet.html?dnt=false&embedId=twitter-widget-0&
features=eyJ0ZndfZXhwZXJpbWVudHNfY29va2llX2V4cGlyYXRpb24iOnsiYnVja2V0IjoxMjA5NjAwLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X2hvcml6b25fdHdlZXRfZW1iZWRfOTU1NSI6eyJidWNrZXQiOiJodGUiLCJ2ZXJzaW9uIjpudWxsfSwidGZ3X3NwYWNlX2NhcmQiOnsiYnVja2V0Ijoib2ZmIiwidmVyc2lvbiI6bnVsbH19&
frame=false&
hideCard=false&
hideThread=false&
id=1444713969990709252& → Replace with the Tweet ID
lang=en-gb&
sessionId=2de329510d62cb3136351f69a6021ab5a4138215& → I don’t know what it refers to. Should I keep it?
theme=light&
widgetsVersion=fcb1942%3A1632982954711&
width=550px”
style=“position: static;
visibility: visible;
width: 395px;
height: 440px; → Is there a way to put it as “flexible” or equivalent. It cuts the bottom of my tweet
display: block;
flex-grow: 1;”
title=“Twitter Tweet”></iframe

Hi again

Sorry about the very late response. I am not sure if this is still relevant, but I had typed up a response to you back in October I somehow never managed to submit. If you have found a solution, please feel free to share this such that others can benefit in the future!

If you are merely interested in displaying a specific tweet, embedding it in an iframe is certainly a reasonable approach. I am not sure what you used to generate the above, but I think you might be making it more complicated than it needs to be.

Indeed, if it is just a single tweet of interest, I would recommend going through https://twitframe.com/ and simply copying the specific tweet, e.g. https://twitter.com/CERN/status/1445418510751043587. Combine the two and create

https://twitframe.com/show?url=https://twitter.com/CERN/status/1445418510751043587

All you need to do then is to add the following wherever:

<iframe 
    border="0" 
    frameborder="0" 
    height="250" 
    width="550"
    src="https://twitframe.com/show?url=https://twitter.com/CERN/status/1445418510751043587">
</iframe>

This, however, does not solve the height issue as you also encountered. Indeed, the height issue concerns the iframe itself as opposed to the actual tweet. What you are interested in doing is to dynamically adjust the size of the iframe depending on the content loaded within. One way of doing this, as outlined by the author of Twitframe, is by using jQuery. That said, since you are only interested in displaying a specific tweet, you should just specify the height parameter to a size appropriate for your specific tweet.

Thanks!