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).
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!
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?
(it seems I cannot paste code here so I have removed the <>)
data-tweet-id=“1445771738290143247” → Replace with the Tweet ID
id=1444713969990709252& → Replace with the Tweet ID
sessionId=2de329510d62cb3136351f69a6021ab5a4138215& → I don’t know what it refers to. Should I keep it?
height: 440px; → Is there a way to put it as “flexible” or equivalent. It cuts the bottom of my tweet
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
All you need to do then is to add the following wherever:
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.