Search code examples
.htaccesstwitterexpressionengine

Twitter share with alternative content


Currently we have a page on a client website that is too large for twitter to crawl on share (>1mb). I want to figure out a way to detect that twitter is crawling the page, and instead serve a limited version of the page.

The website is built in in apache and expressionengine, and so I can use template parsing based on url structure to limit content if necessary.

I also have access to the linux server itself (ssh) if necessary.

So far I am trying to come up with a way to have twitter crawl the url with a query string or something that i can have expression engine listen for.


Solution

  • There are some expression engine addons that allow you to sniff user agents to use as template variables. you can then conditionally display content on whether that user agent is 'Twitterbot'

    Example: https://devot-ee.com/add-ons/browser-detect