@Library.NiceUrl not working like it used to? 4.7.1 to 4.7.1.1
I have two installations of Umbraco. One is 4.7.1, the other is 4.7.1.1.
On the former, the following snippet works great for creating a 'utility' menu on a 'setup' node. It allows me (or someone else) to edit this running utility menu without having to touch a template.
This same structure does not work on my new installation. I've isolated each portion of the string, and it seems to be choking on the @library.NiceUrl portion, in that I can return the ID of the node fine, but when I attempt to return a niceurl, it errors out. When I put it in the template, I get "Error loading MacroEngine script (file: Top-Utility-Menu.cshtml)"
@gary - I'm not totally sure how to allow friendly urls in the config - I didn't see a switch for that anywhere.
@fuji - I don't think I want to just run through all the items on the doctype, since I've set up what amounts to an entire 'setup' node that feeds various bits of information to various spots throughout the sites - footers, images for banners, etc. Although that response may not make sense, in that I may have misunderstood what it was you were showing me. :)
I've had the same issue with the same razor on a 4.7 installation running on localhost. I simply packaged up the site and installed it on this other server, and this script is a failpoint. Makes me think there's something wrong with my syntax, but I'm just not good enough with razor to know what it might be. I tried to keep it ultra simple ...
Should be around line 38 if using Visual Studio, if your document reads "false" it will not understand the NiceUrl part as it will be looking for a .aspx extension on the page.
Have a look at that first, if that isn't the answer, then we can have a look at the code.
@gary - I stared at that node for a few minutes, wondering if that's what you meant, but didn't want to change it on a production server unless I knew it was the right choice.
In any case, altering that doesn't make any difference on either of my broken installations, and the server on which that code DOES work has it set to false, too:
Yes, stranger than fiction - had a similar issue the other day with a line I hadn't changed in the config, but everything worked as it should. Put it down to so many improvements in Umbraco that it was a positive.
Ok, there was an issue surrounding your AncestorOrSelf call, somewhere, can't remember where in updates, it broke
Try AncestorsOrSelf(1), that has always been OK. ie use plural Ancestors, just add the s
If you are just going up to the parent node in your tree, you can use Model.Up(1).
@Library.NiceUrl not working like it used to? 4.7.1 to 4.7.1.1
I have two installations of Umbraco. One is 4.7.1, the other is 4.7.1.1.
On the former, the following snippet works great for creating a 'utility' menu on a 'setup' node. It allows me (or someone else) to edit this running utility menu without having to touch a template.
This same structure does not work on my new installation. I've isolated each portion of the string, and it seems to be choking on the @library.NiceUrl portion, in that I can return the ID of the node fine, but when I attempt to return a niceurl, it errors out. When I put it in the template, I get "Error loading MacroEngine script (file: Top-Utility-Menu.cshtml)"
Anything jump out to anyone? Thanks for reading!
Hi Brenton
Off of the top of my head, have you allowed friendly url's in the config?
G
Not sure why but you could do something like
Folks,
@gary - I'm not totally sure how to allow friendly urls in the config - I didn't see a switch for that anywhere.
@fuji - I don't think I want to just run through all the items on the doctype, since I've set up what amounts to an entire 'setup' node that feeds various bits of information to various spots throughout the sites - footers, images for banners, etc. Although that response may not make sense, in that I may have misunderstood what it was you were showing me. :)
I've had the same issue with the same razor on a 4.7 installation running on localhost. I simply packaged up the site and installed it on this other server, and this script is a failpoint. Makes me think there's something wrong with my syntax, but I'm just not good enough with razor to know what it might be. I tried to keep it ultra simple ...
Hi Brenton
Apologies, used the Umbraco terminology, here is the bit you need to check in the web.config
<appSettings>
<add key="umbracoUseDirectoryUrls" value="true" />
</appSettings>
Should be around line 38 if using Visual Studio, if your document reads "false" it will not understand the NiceUrl part as it will be looking for a .aspx extension on the page.
Have a look at that first, if that isn't the answer, then we can have a look at the code.
Hope it helps
G
@gary - I stared at that node for a few minutes, wondering if that's what you meant, but didn't want to change it on a production server unless I knew it was the right choice.
In any case, altering that doesn't make any difference on either of my broken installations, and the server on which that code DOES work has it set to false, too:
<add key="umbracoUseDirectoryUrls" value="false" />
So that's perplexing.
Hi Brenton
Yes, stranger than fiction - had a similar issue the other day with a line I hadn't changed in the config, but everything worked as it should. Put it down to so many improvements in Umbraco that it was a positive.
Ok, there was an issue surrounding your AncestorOrSelf call, somewhere, can't remember where in updates, it broke
Try AncestorsOrSelf(1), that has always been OK. ie use plural Ancestors, just add the s
If you are just going up to the parent node in your tree, you can use Model.Up(1).
Try that one see if makes a difference
G
is working on a reply...