What we are trying to solve, simplified version of real case:
Client has two document types:
Campaign page
Container page
They have created the following pages, with respective urls:
Container page - /campaigns
╟ Campaign 1 /campaigns/campaign1
╟ Campaign 2 /campaigns/campaign2
╚ Campaign 3 /campaigns/campaign3
Thus, the url of all campaign pages naturally have the slug of the container page prepended in their own full url’s.
What could be a way to have this container page be “invisible”, URL-wise?
Meaning that a request to /campaign1 would result in finding the page “Campaign 1”.
Also, we are using the content delivery api for this. And the idea is also that this should work for deeper nesting, for example /visibleurl1/visibleurl2/invisiblepart/visibleurl3.
What I can think of so far is to use a contentpublishing notification and calculate what our desired url should be, save that as a hidden property and index this in Examine, and then use Examine to search for a url instead. But this requires some extra steps.
Is there any way to interact with the URL parsing controllers in Umbraco somehow? Seeking tips from Umbraco and .NET veterans on this one!
Yes, that helps a bit for sure, but those urls do not work when using the content delivery api.
Furthermore, we’re trying to see if we can solve this so that it works somewhat automatically, specifically so that our client doesn’t have to write their new url in this field for every node they create that they want this effect on. And also further, they’d want to make the “original” url (before the umbracoUrlAlias taking place) to not be viewable.
Possibly something using IContentFinder and IUrlProvider could work here, but I didn’t know about those services until today so will have to investigate more.
If you just want to add it as an alias and don’t mind the ‘original’ url showing in the CMS could you not just use a rewrite? URL Rewriting in IIS or URL rewriting middleware in ASP.Net Core. If you don’t want the original URL to work you can just redirect that to the new rewritten URL.
This is to work dynamically over time for non tech-savvy editors, so we have to find solutions that does not rely on fix predetermined urls and IIS adjustments.
Like Luuk Peters mentioned, we need to use IApiContentPathResolver and IUrlProvider.
Sorry to be late to the party, but we’ve had a package since v8 that could help you with that - it was previously called VirtualNodes, and now it’s part of the Discipline package here: https://www.nuget.org/packages/DotSee.Discipline - look for “VirtualNodes” in the readme.
Currently it’s just up to v13, but we’re working on a v17 version. What it can do is hide the URL segment based on the doctype, and then have the nodes under it generate their URL without it.