MvcSiteMapProvider icon indicating copy to clipboard operation
MvcSiteMapProvider copied to clipboard

Question Load Xml SiteMap from external Resource

Open orney21d opened this issue 7 years ago • 2 comments

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 "MvcSiteMapProvider_SiteMapFileName" 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

orney21d avatar Mar 28 '18 15:03 orney21d

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"

metzing avatar Jul 02 '18 12:07 metzing

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

Thassya avatar Apr 17 '19 12:04 Thassya