Sharing links on Facebook doesn't get the title of topic in RTL languages


(Quenten) #1

Hi,

I’m trying to share links from here, on Facebook. But I don’t get the correct data to show up on Facebook before posting, unlike links from this very forum.

Is this problem related to this ?


(Simon Cossar) #2

I don’t think the problem is RTL. It might have something to do with the locale though. I just tried sharing a post to Facebook from my forum and found that it didn’t work. The problem for me was that I was using a plugin that tries to read the Accept-Language header from the request. It seems that when Facebook scrapes the data they don’t set the Accept-Language request header. This was causing an error with the request. When I disabled the plugin Facebook was able to scrape the data again.

I then tried setting my forum’s locale to ‘ar’ and made a post in Arabic (I don’t speak Arabic so it was just random letters and a picture :slight_smile: ) Facebook was able to scrape the data without any problem.

You can test posts here Log into Facebook | Facebook to see what information Facebook is getting.


(Quenten) #3

Ok the only difference I’m seeing between my site & Discourse is the following:

Inside a topic page I have :
<meta property="og:url" content="http://www.manga-sekai.com/" />
When Discourse has this :
<meta property="og:url" content="https://meta.discourse.org/t/sharing-links-on-facebook-doesnt-get-the-title-of-topic-in-rtl-languages/35852/2" />

og:url tells Facebook to scrap exactly this url. How do I get the meta dynamic ? Any idea?


(Simon Cossar) #4

I have no idea, but that looks like the problem. When I change my locale to ‘ar’ and make a post the url structure I get is http://forum.testeleven.com/t/topic/30. It leaves the title out of the url but that’s ok.