Language Prefix in url / multiple sitemaps

Mar 24, 2011 at 2:05 PM

Hi,

i just found out about the mvc sidemap provider and i like it a lot. I am trying to integrate it into my current project, but i'm facing some problems.

We have localisation through different urls like:

/store/index

/de-DE/store/index

/en-EN/store/index

I created a sitemap for the urls without the language prefix. Is there a simple way to assign this sitemap to the other urls targeting the same page,

so that i can use the "sidemap-path" view?

I'v had some ideas how that could look like, but i did't get it to go:

1) Having multple sidemaps - one for each language code. (Mvc.sitemap.de-DE) ?

2) show the same sitemap-path for all localized versions of a page

 

Maybe there is a solutions that i haven't seen?

Hope someone could help me.

 

Regards,
Chris.

Mar 24, 2011 at 8:21 PM
Edited Mar 24, 2011 at 8:36 PM

I setup my site with language codes to start (just en/fr) and left them out of the site maps entirely.  The language code is marked in the routing, but that's it. i.e.

 

{LanguageCode}/{Controller}/{Action}/{id}

 

I pulled code from this Matt Hawley article.  The Sitemap doesn't need to know about the languages, and a language select in the master page makes moving
between localizations very easy. 

Mar 25, 2011 at 9:32 AM

Thx for the reply.

"The Sitemap doesn't need to know about the languages"

I agree. But i still don't get it.

When i use this view helper: Html.MvcSiteMap().SiteMapPath() - Can be used to generate a so-called "breadcrumb trail"

nothing gets rendert for the localized routes. it only works for the default route which does not include the language token.

I dont't realy see how the link you posted changes that?

 

Regards,
Chris.

Mar 25, 2011 at 3:42 PM

You're right. The URL contains the language token, but the breadcrumbs don't.  I figured since the whole page was in the chosen language, the token didn't need to be in the breadcrumb trail.

If you're dead set on the language token in the sitemap, I think you'd have to have the map reflect the language choices.

<node "EN">
<node "page">
<node "page2">

<node "FR">
<node "page>