【发布时间】:2016-09-30 13:48:01
【问题描述】:
我正在尝试在我的 MVC 4 应用程序中添加页面元标记。 这是我的布局的标题:
<title>@Html.Raw(Model.CurrentPageMetaTags.Title)</title>
<meta name="description" content="@Html.Raw(Model.CurrentPageMetaTags.Description)" />
<meta name="keywords" content="@Html.Raw(Model.CurrentPageMetaTags.Keywords)" />
从模型中填充的元标记为:
Title = "Current page's title";
Description = "Current page's description";
Keywords = "Current page's keywords";
但是当涉及到浏览器时,它会显示如下元标记:
<title>Current page's title</title>
<meta name="description" content="Current page's description" />
<meta name="keywords" content="Current page's keywords" />
标题没有问题,但描述和关键字没有呈现特殊字符!
【问题讨论】:
-
有什么问题? “不渲染”是什么意思,元标记不会被渲染。
-
是的@CodeCaster。撇号没有在元描述和关键字中呈现!
-
再一次,你的意思是什么?元标签不会被渲染。你认为“渲染”是什么意思,你期望什么输出?
-
@CodeCaster Apostrophe 在元描述和关键字内容中显示为 #39;s!这个问题有什么解决办法吗?
-
这不是问题。我也相当确定这只是您的浏览器向您显示的。你在看 source 还是 DOM?
标签: asp.net-mvc-4 razor meta-tags