DXA Preview Plugin for DXA 1.2 and SDL Tridion 2013 SP1

Mark Williams has created a really useful Alchemy Plugin to preview DXA websites in Tridion. Unfortunately for me this was only for the DD4T Tridion 2013 Provider and I needed it for 2013 SP1 as I am building a DXA 1.2 website.

Away I went to get the source from Github to modify the 2013 SP1 Provider that DXA 1.2 uses but I soon realised I was modifying the wrong version. One Stack Exchange question later, Bart had hooked me up with the exact version that I needed to modify which was 2.0.5-beta.

So I have modified the Page Provider to bring over the same code that Mark wrote and voila! I have a working DXA Preview Alchemy Plugin for DXA 1.2 and the DD4T 2013 SP1 Provider.

Only the TridionPageProvider.GetContentByURL() method is modified and here is the code: https://gist.github.com/RyanDurkin/daeb5cfbe0f8a7170e88c9e83c71fe98

Hopefully this will help somebody in the same situation.

DXA Preview Plugin for DXA 1.2 and SDL Tridion 2013 SP1