Orchard CMS content preview not working properly with overrides

145 Views Asked by At

I have created a theme and formatted my blog using view overrides in Orchard. However, when I attempt to preview a blog post, the preview does not take into account these overrides. I think this is due to the fact the preview URL does not match the layout overrides I've created based on URL's.

Actual URL: http://localhost:30321/blog/post-title
Preview URL: http://localhost:30321/Contents/Item/Preview/9460

Is there any workaround to this?

1

There are 1 best solutions below

2
On BEST ANSWER

You want to use alternates, which you can read more about here

Like one of the comments mentioned you shouldn't be doing view overrides (alternates) with urls unless you have a very good use case for it. You would be better off using the content type alternate. So if you had a content type called BlogPost, you could name your view file Content-BlogPost.cshtml. You should add these files to your theme project.