Popular posts with Varnish ESI

But if the single post page is cached in Varnish, wouldn’t the count stay the same?

Yes, if the whole page is cached then the PHP will never get run to update the view count. You’d need an ESI block to call an uncached URL that will increment the view count. Or even an Ajax script would work. Just make sure your VCL doesn’t cache the the ESI block request or Ajax request 🙂