Determined if a block is in admin?

Hi, what I want to do the following:
If a block is added to a page on website that does not support that block (Is not part of the StyleGuide), I want to render the review thumbnail as “THIS BLOCK IS NOT SUPPORTED” and in the frontend (If published anyway) I don’t want the block to render at all, to do this I need to be able to determine if we are in preview inside the Razor template, is this possible today? If not, would it be possible to add a query string the preview, that generates the thumbnails? maybe ?preview=true, so we can add this to the model and render preview specific html.

Any ides, can this be done another way already maybe?

Litium version: 7.1

If you inject the Litium.Web.Routing.RouteRequestLookupInfoAccessor as accessor in your controller you can use accessor.RouteRequestLookupInfo.IsInAdministration to see if we are browsing the page/block in the administration. Also you can use the accessor.RouteRequestLookupInfo.PreviewPageData to fetch more information about the settings that is used when the preview should be rendered.

1 Like