27Aug, 2025
It's Now Possible to Add Multiple Links in the Publish Page URL Module
It's never come up before since I didn't have the need, but we recently added a 2nd publishing target to a site that was a private Content Delivery instance used for preview for non-Sitecore Users. While doing this I wanted to add the preview link in the Content Editor, so this change allows for that.
What I Wanted to Achieve
This screenshot shows what cannot be done with the original module, as it was designed to recognize the language and site the Author is working on, and show the calculated URL for that page since the Content Editor doesn't provide this.

For the moment only one URL is possible, but I want to make the 2nd, “preview” item appear.
Getting All Qualifying Base URLs
The recent change will select a collection of configured items instead of one with FirstOrDefault.
var configRoolUrls = RootUrls.Where(x => x.SiteName == itemSite.Name && x.Language.ToLowerInvariant() == editingItem.Language.Name.ToLowerInvariant()) .OrderBy(x => x.SortOrder);
The following section calculates the page's relative path once published, but since we're now iterating over a collection I don't want to do that each time. I made a change to declare path as a string on its own and add a value to it:
var path = ""; using (new SiteContextSwitcher(itemSite)) { using (new Globalization.LanguageSwitcher(editingItem.Language)) { var options = LinkManager.GetDefaultUrlOptions(); options.AlwaysIncludeServerUrl = false; options.SiteResolving = true; path = LinkManager.GetItemUrl(editingItem, options).ToLowerInvariant(); if (treatItemAsRootUrl) { if (path.StartsWith("/")) path = path.Substring(1); var pathParts = path.Split('/'); if (pathParts.Length > 1) { path = $"/{path.Split('/').First()}/{path.Split('/').Last()}"; } else { path = $"/{path.Split('/').Last()}"; } } } }
Finally cleaning the root URL and adding each path to something to use later:
foreach (var configRootUrl in configRoolUrls) { var rootUrl = configRootUrl.Url; var cleanPath = path.Replace(rootUrl, "").Replace(":443", "").Replace(":80", ""); urls.Add($"{rootUrl}{cleanPath}"); }
Reviewing and Getting This Change
The changes can be reviewed here, and I've created a new set of packages to download in the sc.package folder.