Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have the following structure:
Photo Collage is a page with radio buttons to select one of the products (4x4, 5x5...).
When I click my submit button, I need to go to 'Theme' page which is a direct child of Photo Collage (not in the photo), but the URL needs to change depending on the product selected (the selection influences the content of the Theme page).
This way, I don't have to duplicate the theme page for each product, but the Theme page is bookmarkable with the selected product.
My problem is that after messing for a while with the Umbraco pipeline and reading a lot of posts. I can't figure out how to change the URL. Even though I am sure the URL returned by the IUrlProvider is unique I still get an error on the back end.
public string GetUrl(UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
//throw new NotImplementedException();
// Take curent content item from cache by its id
var content = umbracoContext.ContentCache.GetById(id);
// Check if the content exists and it has alias companyItem
if (content != null && (content.DocumentTypeAlias == "product"))
if (content.Parent.DocumentTypeAlias == "productGroup" && content.Parent.Parent.DocumentTypeAlias == "productDetail")
bool hasThemeAfter = false;
foreach (var child in content.Parent.Parent.Children)
if (child.DocumentTypeAlias == "themes" && child.Children.Count() <= 0)
hasThemeAfter = true;
// Build path
string route = content.Parent.Url + "Themes/" + content.Name + "/";
//var domainUri = new Uri(current.GetLeftPart(UriPartial.Authority));
//return AssembleUrl(domainUri, route, current, mode).ToString();
I think you need to look at implimenting an IContentFinder class.
Content Finders can be injected into the Umbraco Request Pipeline, and you can write code in them to work out what page should be shown based on the URL.
There is quite a good article on Content Finders here : https://24days.in/umbraco-cms/2014/urlprovider-and-contentfinder/
With a content finder you could take your base theme page, and workout the product portion of the URL to redirect umbraco to the correct template.
You will almost certainly want to write a URL Provider too - They are like the reverse of a content finder in that given a peice of content you can work out what the URL(s) will be.
Thanks. I'll look more into the Content Finder and tell you if it works
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted