As previously described, LexasCMS provides a visual in-app preview environment where content teams can easily preview past/present/upcoming content changes in the context of specific audiences.
Content previews work by loading one of your configured preview environments into a frame within the LexasCMS application.
When loading your preview environment, LexasCMS passes a pre-encoded request context to your application via the lexascmsRequestContext
query parameter.
Your application should accept this parameter and pass its value along with any requests to the Content Delivery API.
Before you can begin using content previews, you must first create an API key with permission to retrieve preview content, and then complete the following steps:
To configure a new preview environment, please follow the below steps:
In order for content previews to work correctly, you must install the below code snippet on every page of your application, including 404 pages.
<script type="text/javascript" defer>(function(e,t){void 0!==e.addEventListener&&e.addEventListener("load",function(){var e=t.getElementsByTagName("script")[0],n=t.createElement("script")
n.type="text/javascript",n.async=!0,n.src="https://static.lexascms.com/lexascms.js",e.parentNode.insertBefore(n,e)},!1)})(window,document)</script>
After creating your preview environment, you’ll need to update your application to accept and use the lexascmsRequestContext
query parameter when provided.
As described earlier, this parameter contains a pre-encoded request context which you should pass to any requests to the Content Delivery API as described in either the request context documentation, or the documentation for your chosen integration method.
If you would like to retain the configured preview context while also navigating around your application, you should capture the value of the lexascmsRequestContext
parameter and then store it somewhere that it can be later accessed (e.g. localStorage or your application store).
When the preview context is updated, LexasCMS will automatically reload the current page, updating the value of the lexascmsRequestContext
parameter with the new request context. Your application should accept and begin using this new value.
© 2022 Status200 Ltd.