Embedded reply tweets without prior tweet inclusion [SOLVED]

The tweet shortcode is awesome and handy, but I’m working on a bit of a writing/art project where I replicate a twitter timeline on a post by embedding individual tweets, with some basic css formatting to indicate which tweets are part of a thread, and the tweet embed is including the previous tweet in tweets that are replies. (I assume because that’s the Twitter default embed code.)

The page where I’m trying to do this is at:


(scroll down to the end of Day Four for an example)

I’d rather use the conversation = none option to make things less confused, and I suppose I could just use Twitter’s full HTML embed code for each one to get that. I thought I’d ask and see if anyone had an easier way to do this, via an alternative tweet shortcode or something?


Not as far as I know.

But I suppose that the way to achieve what you want would be to have a look into Twitter’s JSON API and build the Twitter output you need through a custom shortcode.

See the getJSON function in the Docs and its examples.

If Twitter’s API exposes the relevant data keys in theory you could render a reply without the original tweet.


This turned out to not be too hard, once I got around to looking at it again. The internal tweet shortcode in Hugo basically does this:

{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?id=" (index .Params 0)).html | safeHTML }}

so I just added the hide_thread option and put this in my tweet-single.html shortcode template:

{{ (getJSON "https://api.twitter.com/1/statuses/oembed.json?hide_thread=1&id=" (index .Params 0)).html | safeHTML }}

This can also be used to change any of the other embedded tweet options, like hide_media or whatever.

1 Like