Tip: Item not found in recycle bin when un-publishing from preview publishing target
Arvind Gehlot
Sitecore MVP | Sitecore Certified | Solution Architect | Scrum Master
We have configured preview publishing target and that was created with master database. Client wanted to unpublish the item from preview environment, but did not want to delete it from Sitecore. Unmarking the item as publishable and then running the publish job on the item causes the item to delete itself from Sitecore. The item is then not found in the recycle bin, and items that linked to it have a broken link.
Possible Answer
Publish targets are expected to have a single version of item(s) present while the master is expected to be the source of truth containing all versions of all data, including unapproved content changes, this is noted in the documentation here, therefore I don't believe publishing from master to master can be considered an expected setup. I believe if we keep this setup we may find various issues such as content being removed, and potentially many various 'unexpected' results such as we describe. Relating to the recycle bin, I attempted to perform a publish from master to a web publish target, and we don't see the archived item in this web database archive, so I believe it's expected for these items not to be present in the recycle bin when deleted as a result of an 'unpublish'.
Challenge
In XM Cloud, we don't have web database and we also don't have additional Experience Edge instance that can be used for preview purpose. In that case, what value we should use for preview publishing target?
If we have to use Master db (in absence of web db or experience edge), then item should not be deleted while unpublishing it.
What is the correct way of configuring preview publishing target in XM Cloud?
Possible Answer
Usually the Preview GraphQL CM endpoint can be used for preview sites:
The Sitecore Experience Edge for XM Preview GraphQL endpoint is a GraphQL endpoint that mirrors the?schema?and behavior of Sitecore Experience Edge for XM. It enables previewing, editing, and local development without publishing to Experience Edge. https://doc.sitecore.com/xmc/en/developers/xm-cloud/sitecore-experience-edge-for-xm-preview-graphql-endpoint.html
领英推荐
If we are not allowed to use Preview GraphQL endpoint, we could also consider to host the preview site in a lower environment. We can set up a preview publishing target to publish items in non-final workflow state to Edge Delivery endpoint in lower environment: https://doc.sitecore.com/xmc/en/users/xm-cloud/setting-up-a-preview-publishing-target.html
In case Experience Edge is not available to be used for preview purpose, while there is no option to add a new database, we can create our own external database, connect them to the XM Cloud instance, and use it in the publishing target definition.
Using XDT transformation, it should be possible to add a new connecting string: https://doc.sitecore.com/xmc/en/developers/xm-cloud/the-xm-cloud-build-configuration.html
Using a patch configuration, we can add a custom database configuration following the approach on how a Master DB has been defined: