check if page is loading in admin vs live site

lawrence whittemore asked on February 17, 2022 16:53

Is there a way to check if a page is loading in the admin vs the front end? I have code that I need to run only on the front end.

Recent Answers


Liam Goldfinch answered on February 17, 2022 17:21

I would recommend looking at this package, and associated blog posts.

https://github.com/wiredviews/xperience-page-builder-utilities

Then you can either use the dependency injected IPageBuilderContext or the tag helper <page-data-context>.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.