[SOLVED] Twitter Cards for links


Is there, or are there plans to implement, support for twitter cards for posts on write.as? I assume there is no way to add them through inline HTML tags in the markdown of a post?

Update: I am a programmer and have some web development experience, though mainly on the back-end side of things, and would be willing to spend some of my spare time on this, depending on how much work it would be (I don’t have infinite spare time).

Hi @albins,

So there is a way to embed Twitter cards. It requires that you have a Pro plan to edit the Custom Javascript of your site.

Go into Customize, scroll down to Custom Javascript, and add the following :

// src: https://platform.twitter.com/widgets.js

Then go ahead and copy the embedded tweet code and paste it into the post. To center align the tweet, make sure to add ‘tw-align-center’ to the class of the block quote.

<blockquote class="twitter-tweet tw-align-center">

The end result should look something like this. I hope this helps! And a shout out to @digitalgyoza for sharing this solution in his post about cool ways to tailor your Write.as blog.


Thank you @cjeller1592! That’s very cool and answers a different question I had, but what I meant was the meta tags used to get nice previews for links on twitter.

@albins is this on write.as or a selfhosted instance? I’m just curious to check out a page as an example.

@robjloranger it’s hypothetical for now, but it would be on write.as.

It is already supported, so you should be good to go. :nerd_face: For example this is the twitter card validator pointed at one of my blog posts.

Also, I believe that the card will feature the first image (if any) in your post but I’m not certain.

1 Like

Oh that’s great! I didn’t see it mentioned anywhere so I just assumed it wasn’t supported.

1 Like

I also learned that twitter will just use open graph tags if the twitter specific ones are not present.

I sure wish that things like this would be ported to the write.as docs. I looked everywhere in the docs for how to embed things, and only after digging into the forums did I find this.

Why is this great information ( embedding in general, this post in particular ) not on the docs? And if it is, it must be SUPER hard to find because I searched for quite a while before coming here.