我在我的 MVC3 站点中使用 MVCSiteMapProvider,并且我最近在 mvc.sitemap 中的节点中添加了元关键字和描述
< mvcSiteMapNode controller="Home" action="Index" title="Home" description=""keywords="home, home page, 欢迎" >
... 例如。
然后我的视图像这样填充它:
@{ 字符串标题 = ""; 字符串关键字 = ""; 字符串描述 = "";
if (SiteMap.CurrentNode != null) { title = SiteMap.CurrentNode["title"]; keywords = SiteMap.CurrentNode["keywords"]; description = SiteMap.CurrentNode["description"]; }
}
<标题>>@标题</标题>>
<meta name="keywords" content="@keywords" />
<meta name="description" content="@description" />
在我使用的所有页面上:
@Html.MvcSiteMap().Menu(0, true, true, 1)
自从我开始将内容放入关键字部分以来,菜单中的链接填充如下:
<a href="/?keywords=home%20%2C%20Home%20Page%2C%20welcome" >首页</a>
我不确定为什么会出现这种情况,我希望它不存在。有人有想法么?