mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#19289: Fixing http-equiv meta tags management
Work Item: 19289 --HG-- branch : 1.x
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
Style.Require("jQueryUI_Orchard").AtHead();
|
Style.Require("jQueryUI_Orchard").AtHead();
|
||||||
Script.Require("jQueryUI_Tabs").AtHead();
|
Script.Require("jQueryUI_Tabs").AtHead();
|
||||||
|
|
||||||
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
|
SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible");
|
||||||
Style.Include("~/themes/theadmin/styles/site.css");
|
Style.Include("~/themes/theadmin/styles/site.css");
|
||||||
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
||||||
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
@model Orchard.Media.ViewModels.MediaFolderEditViewModel
|
@using Orchard.Media.Extensions;
|
||||||
@using Orchard.Media.Extensions;
|
|
||||||
@using Orchard.Media.Helpers;
|
@using Orchard.Media.Helpers;
|
||||||
@using Orchard.Media.Services;
|
@using Orchard.Media.Services;
|
||||||
@using Orchard.Media.Models;
|
@using Orchard.Media.Models;
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
Script.Require("jQueryUI_Tabs").AtHead();
|
Script.Require("jQueryUI_Tabs").AtHead();
|
||||||
Script.Include("MediaBrowser.js").AtHead();
|
Script.Include("MediaBrowser.js").AtHead();
|
||||||
|
|
||||||
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
|
SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible");
|
||||||
Style.Include("~/themes/theadmin/styles/site.css");
|
Style.Include("~/themes/theadmin/styles/site.css");
|
||||||
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
||||||
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
|
@{
|
||||||
@{
|
SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible");
|
||||||
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
|
|
||||||
Style.Include("~/themes/theadmin/styles/site.css");
|
Style.Include("~/themes/theadmin/styles/site.css");
|
||||||
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection");
|
||||||
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection");
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
/* Global includes for the theme
|
/* Global includes for the theme
|
||||||
***************************************************************/
|
***************************************************************/
|
||||||
|
|
||||||
SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
|
SetMeta(httpEquiv: "X-UA-Compatible", content: "IE=edge,chrome=1");
|
||||||
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
|
Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin");
|
||||||
Style.Include("site.css");
|
Style.Include("site.css");
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ namespace Orchard.Mvc {
|
|||||||
IDisposable Capture(Action<IHtmlString> callback);
|
IDisposable Capture(Action<IHtmlString> callback);
|
||||||
|
|
||||||
void RegisterLink(LinkEntry link);
|
void RegisterLink(LinkEntry link);
|
||||||
void SetMeta(string name, string content);
|
void SetMeta(string name, string content, string httpEquiv, string charset);
|
||||||
void SetMeta(MetaEntry meta);
|
void SetMeta(MetaEntry meta);
|
||||||
void AppendMeta(string name, string content, string contentSeparator);
|
void AppendMeta(string name, string content, string contentSeparator);
|
||||||
void AppendMeta(MetaEntry meta, string contentSeparator);
|
void AppendMeta(MetaEntry meta, string contentSeparator);
|
||||||
|
@@ -126,8 +126,26 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
|||||||
ResourceManager.RegisterLink(link);
|
ResourceManager.RegisterLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMeta(string name, string content) {
|
public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) {
|
||||||
SetMeta(new MetaEntry { Name = name, Content = content });
|
var metaEntry = new MetaEntry();
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(name)) {
|
||||||
|
metaEntry.Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(content)) {
|
||||||
|
metaEntry.Content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(httpEquiv)) {
|
||||||
|
metaEntry.HttpEquiv = httpEquiv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(charset)) {
|
||||||
|
metaEntry.Charset = charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetMeta(metaEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetMeta(MetaEntry meta) {
|
public virtual void SetMeta(MetaEntry meta) {
|
||||||
|
@@ -77,8 +77,26 @@ namespace Orchard.Mvc {
|
|||||||
Html.GetWorkContext().Resolve<IResourceManager>().RegisterLink(link);
|
Html.GetWorkContext().Resolve<IResourceManager>().RegisterLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMeta(string name, string content) {
|
public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) {
|
||||||
SetMeta(new MetaEntry { Name = name, Content = content });
|
var metaEntry = new MetaEntry();
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(name)) {
|
||||||
|
metaEntry.Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(content)) {
|
||||||
|
metaEntry.Content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(httpEquiv)) {
|
||||||
|
metaEntry.HttpEquiv = httpEquiv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(charset)) {
|
||||||
|
metaEntry.Charset = charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetMeta(metaEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetMeta(MetaEntry meta) {
|
public virtual void SetMeta(MetaEntry meta) {
|
||||||
|
@@ -66,8 +66,26 @@ namespace Orchard.Mvc {
|
|||||||
Html.GetWorkContext().Resolve<IResourceManager>().RegisterLink(link);
|
Html.GetWorkContext().Resolve<IResourceManager>().RegisterLink(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMeta(string name, string content) {
|
public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) {
|
||||||
SetMeta(new MetaEntry { Name = name, Content = content });
|
var metaEntry = new MetaEntry();
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(name)) {
|
||||||
|
metaEntry.Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(content)) {
|
||||||
|
metaEntry.Content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(httpEquiv)) {
|
||||||
|
metaEntry.HttpEquiv = httpEquiv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!String.IsNullOrEmpty(charset)) {
|
||||||
|
metaEntry.Charset = charset;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetMeta(metaEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SetMeta(MetaEntry meta) {
|
public virtual void SetMeta(MetaEntry meta) {
|
||||||
|
@@ -300,21 +300,31 @@ namespace Orchard.UI.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void SetMeta(MetaEntry meta) {
|
public void SetMeta(MetaEntry meta) {
|
||||||
if (meta == null || String.IsNullOrEmpty(meta.Name)) {
|
if (meta == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_metas[meta.Name] = meta;
|
|
||||||
|
var index = meta.Name ?? meta.HttpEquiv ?? "charset";
|
||||||
|
|
||||||
|
_metas[index] = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AppendMeta(MetaEntry meta, string contentSeparator) {
|
public void AppendMeta(MetaEntry meta, string contentSeparator) {
|
||||||
if (meta == null || String.IsNullOrEmpty(meta.Name)) {
|
if (meta == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var index = meta.Name ?? meta.HttpEquiv;
|
||||||
|
|
||||||
|
if (String.IsNullOrEmpty(index)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
MetaEntry existingMeta;
|
MetaEntry existingMeta;
|
||||||
if (_metas.TryGetValue(meta.Name, out existingMeta)) {
|
if (_metas.TryGetValue(index, out existingMeta)) {
|
||||||
meta = MetaEntry.Combine(existingMeta, meta, contentSeparator);
|
meta = MetaEntry.Combine(existingMeta, meta, contentSeparator);
|
||||||
}
|
}
|
||||||
_metas[meta.Name] = meta;
|
_metas[index] = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user