如何更改 Orchard 中默认的 html 标签渲染?
How to change default html tag rendering in Orchard?
我启用了主题,Orchard 呈现页面如下
<!DOCTYPE html>
<html lang="de-DE" class="static dir-ltr dennree-tuesdaymail" dir="ltr">
<head>
<meta ...
但我需要这样渲染
<!DOCTYPE html>
<!--[if IE 8]> <html lang="de" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="de" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="de" xml:lang="de">
<!--<![endif]-->
<head>
<meta ...
我没有找到任何方法来调整 Orchard 主题 Layout.cshtml 中的 html 标签呈现。
有什么解决办法的建议吗?
您必须在主题中创建 Document.cshtml
。
@using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@{
RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")});
Script.Include("html5.js").UseCondition("lt IE 9").AtHead();
string title = Convert.ToString(Model.Title);
string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
}
<!DOCTYPE html>
<html lang="@WorkContext.CurrentCulture" class="static @Html.ClassForPage()">
<head>
<meta charset="utf-8" />
<title>@Html.Title(title, siteName)</title>
@Display(Model.Head)
<script> (function (d) { d.className = "dyn" + d.className.substring(6, d.className.length); })(document.documentElement);</script>
</head>
<body>
@* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>
我启用了主题,Orchard 呈现页面如下
<!DOCTYPE html>
<html lang="de-DE" class="static dir-ltr dennree-tuesdaymail" dir="ltr">
<head>
<meta ...
但我需要这样渲染
<!DOCTYPE html>
<!--[if IE 8]> <html lang="de" class="ie8"> <![endif]-->
<!--[if IE 9]> <html lang="de" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="de" xml:lang="de">
<!--<![endif]-->
<head>
<meta ...
我没有找到任何方法来调整 Orchard 主题 Layout.cshtml 中的 html 标签呈现。
有什么解决办法的建议吗?
您必须在主题中创建 Document.cshtml
。
@using Orchard.Mvc.Html;
@using Orchard.UI.Resources;
@{
RegisterLink(new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("~/modules/orchard.themes/Content/orchard.ico")});
Script.Include("html5.js").UseCondition("lt IE 9").AtHead();
string title = Convert.ToString(Model.Title);
string siteName = Convert.ToString(WorkContext.CurrentSite.SiteName);
}
<!DOCTYPE html>
<html lang="@WorkContext.CurrentCulture" class="static @Html.ClassForPage()">
<head>
<meta charset="utf-8" />
<title>@Html.Title(title, siteName)</title>
@Display(Model.Head)
<script> (function (d) { d.className = "dyn" + d.className.substring(6, d.className.length); })(document.documentElement);</script>
</head>
<body>
@* Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@
@Display(Model.Body)
@Display(Model.Tail)
</body>
</html>