Closed markadrake closed 4 weeks ago
Hey @markadrake, I think my suggestion is similar to what has been suggested on the linked issue in the Umbraco-CMS repo.
You are probably best using @Context.Request.IsBlockPreviewRequest()
in your Razor views where you want to render something specific for the preview in the backoffice but not on the front end.
Which Umbraco.Community.BlockPreview version are you using?
1.8.4
Which Umbraco version are you using? For example: 10.4.0 - don't just write v10
13.3.2
Bug summary
I'm attempting to add some code to a razor file that should only render if it's being rendered in the backoffice.
I believe the approach in the past was to reference
UmbracoContext.IsFrontEndUmbracoRequest()
.I tried to use this but it actually returns true when a razor partial is rendered from the backoffice.
Steps to reproduce
Add this to any razor file you are trying to render in the backoffice:
Expected result / actual result
I'd expect "Hello Backoffice!" to render only in the backoffice preview. It currently doesn't render anywhere.
IsFrontEndUmbracoRequest()
always returnstrue
.