Entry previews can be added to Admin UI by registering an URL pattern for the specific entry type. This can be done with the following code:
:- use_module(library(bc/bc_type)). :- bc_register_preview(post, '/post/<slug>').
This will add a button "Save & Preview" on the entry editor form when the type of the edited entry is
post. The entry is saved and the URL with the
<slug> placeholder replaced with the actual slug is opened in a new window/tab.