cloudscribe/cloudscribe.Web.Navigation

Override Nodes at Startup

Closed this issue · 2 comments

pbros commented

Hello,

In my navigation, I have links to external urls which change depending on the environment (Dev, QA, Staging, Production) the site is in running. Currently, I need to maintain a different navigation.xml per environment (e.g. navigation.QA.xml, navigation.Staging.xml), which is set in the navigation options in appSettings.json using "NavigationMapXmlFileName": "navigation.QA.xml",

The structure of all of these is identical except for the URLs of a few nodes.

Would it be possible to not have to maintain full xml files per environment, but instead have the ability to override certain node by key at startup. I know there is a node adjuster, but my understanding is that it's a per page/request override, and not a global one.

I would suggest maybe adding a dictionary to the Navigation Options, where we can set the Url per NodeKey.

I just published an updated nuget https://www.nuget.org/packages/cloudscribe.Web.Navigation/2.1.11

I added a new interface just for you INavigationTreeProcessor

you can implement and inject 1 or more of those and process the tree immediately after it is built and before it gets cached. I only added it for XmlNavigationTreeBuilder so it won't work currently for JsonTreeBuilder.

That gives you the opportunity to update any node using whatever logic you want.

pbros commented

Great, thanks! I'll take a look