maartenba / MvcSiteMapProvider

An ASP.NET MVC SiteMapProvider implementation for the ASP.NET MVC framework.
Microsoft Public License
537 stars 220 forks source link

Question Load Xml SiteMap from external Resource #477

Open orney21d opened 6 years ago

orney21d commented 6 years ago

Hi, We are using MvcSiteMapProvider in MVC5 project. We have static sitemap in the directory with the following structure:

WebSite --SiteMapFolder -----WebMvc.sitemap -----WebMvcSiteMapSchema.xsd

And we have too defined a Template to load Breadcrumbs, i use this just for Breadcrumbs. Then in a layout i call the Helper: @Html.MvcSiteMap().SiteMapPath("MyCustomTemplateInSharedViewsFolder") Until now all ok, but, we will implement multilanguage in a site, and we wana have our xml .sitemap structure y a Resource.resx file.

We would like to have a way to override "BuildSiteMap" method of "XmlSiteMapBuilder" or some specific class just to load XML sitemap from our Source (resources or wathever...) and not from the path specified in "_MvcSiteMapProviderSiteMapFileName" in web.config. I Supose we should too set the schema validation .XSD....

As detail i should mention we do not use DI Contaner in our project...

I appreciate any help. My english is not good, so, sorry for that.

Thanks, Orney

metzing commented 6 years ago

Hi

I belive using resources is implemented already. (Based on how we use it in our project.)

Using <mvcSiteMapNode title="$resources:SiteMap,Resource1" /> will load from ~/Resources/SiteMap.resx with the resource key "Resource1"

Thassya commented 5 years ago

But If the Resource.resx imported as a Reference in the project, the only way is with external DI Contaner ?