Instagram oneboxing

What a fantastic set of solutions!

People can see now it’s a video at a glance too.

Great work everyone, thanks for the amazingly quick response to this issue too :clap:


Awesome work on this.

My only request is if there is a way to make the onebox mention my Instagram account name a little less?

For me the most important part is the image so I’d appreciate a way to somehow hide at least the “Account Name on Instagram” heading (the link leads to the linked page) and perhaps even the caption?

1 Like

This is probably easiest accomplished via a local CSS customization, under Admin, Customize. You could hide or de-size the element through standard CSS.


I do agree that the “on Instagram” part is redundant though @techapj… we’re saying it twice, and everyone knows how I feel about needless repeated text :wink:


Fixed in


How about the top becomes So much neater.

Also “Matt Sephton (@mattsephton) on Instagram” at the start of the caption also feels needlessly repetitive.

As for local CSS, is that per user or globally for a board? Because I’m not admin of any boards.

1 Like

I noticed something about URL parsing. Oneboxing fails and produces just the image if the URL contains the Instagram username.

This won’t work as intended:

This works:


@Roman_Rizzi can you add investigating this to your list (once you free us from other work)


Just pushed a fix:

Will bump onebox version in discourse soon.


The fix is now live on meta:


Hi Sam, is Instagram oneboxing broken? Test:

1 Like

You wrote

But let’s see


@Roman_Rizzi Looks like updated regex for username broke the regular Instagram links. Can you fix?


I relaxed the regexp a little bit and added an additional test to cover both cases.


Following up here as I’ve noticed broken Instagram oneboxes on our site…

Is this supposed to make it so that the Instagram onebox preview images no longer break? Because if so, it seems that’s not currently working for us. It may be specific to video posts (not sure as pretty much all examples on our site are videos).

See e.g. this post on our site (from just a few weeks ago): Forearm rotation clip on this blog? - Playing Technique - The Cracking the Code Forum

Same with several others. Rebuild does fix, e.g. displays like so after rebuilding the post: Black star lick HELP ME - Playing Technique - The Cracking the Code Forum

I see some video embeds above in this very topic do still work, so not sure if there’s some other variable with this only happening for certain accounts.

If this is an intentional thing from Instagram without an easy workaround, this is a good suggestion:

Basically — a daily / weekly job (not sure how long exactly the Instagram embeds expire) to run Rebake all posts matching a pattern matching I think would do the trick.

It should only be much older posts, not a recurring thing. So a one time global rebake should fix all.

Right that’s what I thought at first, and I did a rebake on all our posts w/ Instagram links like a month or two back which I thought would fix this permanently.

But even recent posts (examples: one, two, three) now have the broken preview images again.

Hmm maybe @techAPJ could have a look.

1 Like

Hey Brendan, can you verify that the setting download remote images to local is enabled on your site? Also can you make sure that download remote images threshold is satisfied on your server, i.e. your server has required percentage of minimum disk space?


Server has space, but looks like we did not have that setting enabled, I will turn it on now and run the rebake again. Thanks for the help here!


Following up here, I found that after enabling download remote images to local (with plenty of disk space free) and rebaking, the Instagram onebox preview images were still breaking.

EDIT: ahhh as I’m writing this I think I see what’s going on.

Newer Instagram posts did have the correct image URLs from our domain, while older ones still had the expiring Instagram ones. When I did the rebake for all old embeds, I didn’t realize the site setting download remote images max days old (default 30 days) was limiting this.

So I changed that setting to 9999 and did the rebake again, seems to be working now! (Leaving this rubber-ducking post here just in case this helps clarify for anyone else…)