When using explicit localization only Title and Description attributes of a SiteMapNode are to localized properly. Any custom attributes return NULL.
Example SiteMapNode:
<mvcSiteMapNode controller="Home" action="Index" title="$resources:MainSitemap,HomeTitle" description="$resources:MainSitemap,HomeMetaDescription" metaKeywords="$resources:MainSitemap,HomeMetaKeywords" >
I am using my own HtmlHelper to write the keywords out to the view, but it always errors saying the value of metaKeywords is null.
public static MvcHtmlString MetaKeywords(this HtmlHelper helper)
{
if (MvcSiteMapProvider.SiteMaps.Current != null && MvcSiteMapProvider.SiteMaps.Current.CurrentNode != null)
{
MvcSiteMapProvider.ISiteMapNode node = MvcSiteMapProvider.SiteMaps.Current.CurrentNode;
if (node != null && node.Attributes.ContainsKey("metaKeywords") && node.Attributes["metaKeywords"] != null && !String.IsNullOrWhiteSpace(node.Attributes["metaKeywords"].ToString()))
{
return new MvcHtmlString(String.Format("<meta name=\"keywords\" content=\"{0}\" />", node.Attributes["metaKeywords"].ToString()));
}
}
return new MvcHtmlString(string.Empty);
}
Not the cleanest code but i was trying to debug what was null.
I know that this is not the best way to handle Keywords or Description, but none the less, it looks like this is suppose to work and there is a problem fetching the resources for other attributes. I am updating from an older version where i used to use implicit localization and this worked, so this is kind a big issue for me.
Any help would be great. Thanks
When using explicit localization only Title and Description attributes of a SiteMapNode are to localized properly. Any custom attributes return NULL.
Example SiteMapNode:
I am using my own HtmlHelper to write the keywords out to the view, but it always errors saying the value of metaKeywords is null.
Not the cleanest code but i was trying to debug what was null.
I know that this is not the best way to handle Keywords or Description, but none the less, it looks like this is suppose to work and there is a problem fetching the resources for other attributes. I am updating from an older version where i used to use implicit localization and this worked, so this is kind a big issue for me.
Any help would be great. Thanks