Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Wordpress plugin amendments to allow for Facebook instant articles

Paul May 12, 2016 06:34PM EDT

Hello internet.

Just experiment with Facebook instant articles and the Wordpress plugin from Automatic (https://github.com/Automattic/facebook-instant-articles-wp).

We've used the FeedBlitz FeedSmart plugin for a few years with success. However, we now have to include a new exception to its redirection rules.

Looking at the source I see it excludes Feedblitz from the redirection rules. I think we need a new exception for Facebook's user-agent. This is because the Facebook plugin generates the instant article feed in the following location /feeds/instant-articles. Here's the line that excepts Feedblitz itself from the redirect back to feedblitz.

if (!preg_match("/feedblitz/i", $_SERVER['HTTP_USER_AGENT'])..... (line 49 of my version of the FeedBlitz_FeedSmart.php file)

This is what I've modified it to as a provisional test:

if (!preg_match("/feedblitz/i", $_SERVER['HTTP_USER_AGENT']) || !strpos($_SERVER['HTTP_USER_AGENT'], "facebookexternalhit")) {

Do you think this will suffice? Does anyone else have experience with instant articles and the user-agent Facebook uses to query the feed?

Up -1 rated Down
Phil Hollows May 13, 2016 11:12AM EDT FeedBlitz, LLC Agent
I don't see why Facebook needs the redirection, but you'll be able to see the user agent in your web site logs. If it rejects the FeedBlitz feed at first, add &x=1 to the feed url to disable the browser friendly version of the feed.
Up 2 rated Down
Paul May 15, 2016 10:14PM EDT
Hi Phil,

Thanks for the feedback. I've checked our logs and "facebookexternalhit/1.1" is the user-agent for future reference.

As to why we need to *avoid* the redirect: this is not a standard xml-rss or atom feed. It's one generated by the Wordpress Instant Articles plugin that formats the content in a way that Facebook can transliterate into an instant article. But the plugin as it stands redirects /feed/* to Feedblitz.

So far as I can tell, the code change I've made to the plugin has worked. We have been seeing updates to the instant articles appear in the Facebook Pages app and the feed is waiting for manual approval with Facebook themselves.

Hope this helps others.

Paul
Up 0 rated Down
Phil Hollows May 16, 2016 08:47AM EDT FeedBlitz, LLC Agent
I appreciate the feedback!

This question has received the maximum number of answers.

Feedblitzsupport@gmail.com
http://assets2.desk.com/
false
@feedblitz
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete