Universal Comments Meta Tags with Prerender IO
I have a customer who has a working set up of Universal Comments. Their only problem is that they have no meta data on their blog, so all articles come over to Vanilla with only the link back to the blog post.
They let me know that they are a single page application and their meta data for the blogpost is generated dynamically by JavaScript when the website loads.
In order to let bots scrape their content they use prerender.io where they choose what to show using the UserAgent tag. So the only way to make that works is to understand what is the user agent of Vanillas Bot.
Comments
-
In Vanilla's current state, I don't think user agents are going to be of much help here.
- When we create a new discussion to attach embedded comments for a particular foreign ID to, we use the
fetchPageInfofunction (https://github.com/vanilla/vanilla/blob/61a007beb132afc10302a898a813a29f0bf7d065/applications/vanilla/controllers/class.postcontroller.php#L520) - The
fetchPageInfofunction usesProxyRequestto make its requests to the remote server (https://github.com/vanilla/vanilla/blob/61a007beb132afc10302a898a813a29f0bf7d065/library/core/functions.general.php#L1032). ProxyRequestmakes its requests to remote servers using the same user agent as the browser initiating the request (i.e. the browser of the user commenting). Failing that, it defaults to a user agent formatted as “Vanilla/(version)” (https://github.com/vanilla/vanilla/blob/61a007beb132afc10302a898a813a29f0bf7d065/library/core/class.proxyrequest.php#L427).
If a user posts a comment from Firefox, and no discussion already exists, it'll pass along the user's Firefox user agent string to the remote server. In the event Vanilla can't detect the user agent, it'll send its own, from step three. If the customer adds Vanilla's user agent string, it's still very likely it'll continue to miss out on Prerender's middleware, because the individual's user agents won't be recognized.
0 - When we create a new discussion to attach embedded comments for a particular foreign ID to, we use the
-
I think we are solving for the wrong issue. It's about rendering the info we need.
I am far from an expert with prerender , but it seems they would need to look at how to delay before they push the meta tags.
Maybe something like https://github.com/nfl/react-helmet???
Like I mentioned I'm no dev, but I it will be easier for them to modify how their site works, than for us to change Vanilla.
See:
Maybe @Ryan you have another thought to solve for the blank meta tags because it's one a one page app rather than worrying about how Vanilla works.
Otherwise, I think they need to speak with prerender.io
0