Mikkel
Mikkel

Reputation: 1865

Umbraco gets wrong current node?

I'm experiencing an issue where my Umbraco project gets the wrong PublishedContent node when using UmbracoContext.Current.PublishedContentRequest.PublishedContent, it seems like it's getting the current node's parent.

This is probably a long shot as I really have no information to give as far as this question goes, I have no idea where it's going wrong. I didn't start this project, it's just been handed over to me and I have to finish it.

This Umbraco project has URL rewriting on the page where I can't get the current node. The page has several URL's and if I go to the canonical URL of the page, it can get the node just fine.

I'm hoping someone can help me.

Thank you in advance!

Upvotes: 0

Views: 295

Answers (1)

Eyescream
Eyescream

Reputation: 921

Umbraco has a default feature called alternative template: if a template has the alias Tpl and you go to /Page/Tpl umbraco will render the Page node with the Tpl template, exactly like if you were calling /Page/?altTemplate=Tpl.

So maybe your issue is to have a url that has the template name in it. If that's the case you can rename that template alias to something else or remove this behavior by editing the file ~/config/404handlers.config, removing the line that contains

<notFound assembly="umbraco" type="SearchForTemplate" />.

Upvotes: 1

Related Questions