Tuesday 4 September 2018

Post-Processing html after it has been generated in Sitecore

Sometimes we might want to do an operation on the entire html generated for a page, such as move elements around, do some text replacements or regex-based url amendments.  The MVC framework has various features like action filters, result filters and so on, but we can't really use these with Sitecore the same way we would a native MVC site.  In traditional MVC your page is the result of a single action, but in Sitecore it is lots of actions stitched together so there is a little more work to do, so let's get started.