Shareable preview URLs
Shareable preview URLs let editors share the page previews with contributors who can’t access the administration, allowing the external contributors to see the changes that are not yet visible on the live site. Users need the Read permission to create a shareable preview URL.
Anybody with the link can access the shareable preview. If your project uses Google Analytics or similar tracking tools, we recommend excluding the shareable URLs from tracking to avoid unintentional leaks of the URLs to search engines.
The feature is not available for pages excluded from content tree-based routing and for pages with a custom authorization scheme.
The shareable preview URLs are created under the domain where the project is running. If your project limits access to certain environments (QA, Staging) and editors generate the URLs from these environments, make sure that the external reviewers can access the shareable preview URLs.
Expiration
Shareable preview URLs expire after a certain amount of time. The intended workflow is that editors create these URLs for pages in the Draft step and the system automatically invalidates the corresponding URLs when the page is published. As a safeguard, the URLs also automatically expire after a configurable expiration period, even if the page hasn’t been published yet.
For completeness, a shareable preview URL is invalidated when any of these conditions is met:
- The configured automatic expiration period elapses.
- A user stops sharing the preview and therefore invalidates all associated shareable preview URLs.
- The page is published or unpublished.
- A new version of the page is created, for example, by:
- reverting to the currently published version.
- restoring a previously published version.
- creating a new version for an unpublished page.
- editing a published page.
- The page is deleted.
When users continue to make edits on a page in the Draft status or a custom workflow step, the URL stays valid and the changes are reflected on the preview if saved. Scheduling a page for publishing does not immediately invalidate its shareable preview URLs and they are disabled only when the page is published.
To invalidate all shareable preview URLs in the system, disable the feature in the Settings application.
URL changes
Shareable preview URLs rely on the page’s canonical URL. If the page’s canonical URL changes, the preview link stops working. Shareable URLs generated after the change work normally unless further modified. Note that the canonical URL may change when the page is moved or a parent page is renamed.
Change automatic expiration
By default, shareable preview URLs automatically expire after 7 days if not invalidated earlier. To change this setting:
- In the Settings application, go to Content → URLs and SEO.
- Set the desired Expiration time under Shareable preview URLs.
- You can set ‘0’ to prevent the default automatic expiration, however the URLs can still expire due to other reasons.
- Save the changes.
From now on, the set automatic expiration applies to newly created shareable URLs. Existing links expire based on the setting that was in place when they were generated.
Disable shareable preview
By default, shareable preview URLs are enabled. You can disable the feature, which also invalidates all existing shareable URLs in the system.
To disable the shareable preview URLs:
- In the Settings application, go to Content → URLs and SEO.
- Clear the Allow shareable preview URLs for pages checkbox.
- Save the changes.
Verify if a page has an active shareable preview URL
To find out if a page preview has any active shareable preview URLs:
- Locate the selected page in a website channel application.
- Go to the URLs tab.
- Under Shareable preview URL, verify whether the page is shared or not.
Exclude shareable preview from analytics
If you’re using Google Analytics or other similar tools, we recommend excluding the shareable preview URLs from tracking to prevent unintentional leaking of the URLs to search engines.
You can achieve this, for example, by not including the tracking scripts in the Views for pages in preview mode (impacts both the internal preview mode and the shareable preview):
@using CMS.Websites.Routing
...
@inject IWebsiteChannelContext websiteChannelContext;
...
@if (websiteChannelContext.IsPreview)
{
// custom logic to prevent the execution of analytics scripts
}
If you’re using the Xperience by Kentico tag manager integration, you can choose to not include tracking scripts on preview pages, which applies to both the administration and shareable preview.