URL of unpublished items
# help-with-umbraco
j
Hi, this might be super simple, but I can't find anything about it. I would like to know if there's a simple way of knowing what the url to an unpublished item will be before I publish it. And showing it in the backoffice for our users, they are sending newsletters automatically early in the morning and they want to automatically publish items at the same time, but they can't find what the url would be (even if it's kind of easy to guess most of the time) (Umbraco 13) https://cdn.discordapp.com/attachments/1346114403384164444/1346114403577364552/Screenshot_2025-03-03_at_14.32.22.png?ex=67c7023b&is=67c5b0bb&hm=3e81c6a41856691a0d777ba61221528f1d367e09cb426ef871480fc91dfcd76d&
j
Urls are only created for published items, however if you can find fx the parent url you can append something like
/node.Name.ToUrlSegment(_shortStringHelper)
which will give you the name of the current node as an url safe string using the same string extension Umbraco uses themselves. To edit the links box: https://docs.umbraco.com/umbraco-cms/reference/notifications/editormodel-notifications/customizing-the-links-box
j
Hi, thanks for the fast response, I will try to do it that way then 🙂
b
it might not fit to all usecases, but I think can be an option in your case:
PubilshedContentCache
actually does contain the last saved version as well, so it can be used to get data for previewing a certain node, that is what the
ApiPublishedContentCache
is using as well (https://github.com/umbraco/Umbraco-CMS/blob/ac3b17b3904f80ca7ef6f19909f92b17379b8176/src/Umbraco.Core/DeliveryApi/ApiPublishedContentCache.cs#L96). So to get an
IPublishedContent
for the latest saved version is basically half way there to get a URL as well, but not something we specifically tried 🙂
5 Views