diff --git a/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs b/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs index 3964858e5..4a3f5e49f 100644 --- a/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs +++ b/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs @@ -127,24 +127,7 @@ namespace Orchard.Mvc.ViewEngines.Razor { } public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { - 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; - } - + var metaEntry = new MetaEntry(name, content, httpEquiv, charset); SetMeta(metaEntry); } diff --git a/src/Orchard/Mvc/ViewPage.cs b/src/Orchard/Mvc/ViewPage.cs index e3c9c2fb7..5889ef0f6 100644 --- a/src/Orchard/Mvc/ViewPage.cs +++ b/src/Orchard/Mvc/ViewPage.cs @@ -78,24 +78,7 @@ namespace Orchard.Mvc { } public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { - 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; - } - + var metaEntry = new MetaEntry(name, content, httpEquiv, charset); SetMeta(metaEntry); } @@ -182,4 +165,4 @@ namespace Orchard.Mvc { public class ViewPage : ViewPage { } -} \ No newline at end of file +} diff --git a/src/Orchard/Mvc/ViewUserControl.cs b/src/Orchard/Mvc/ViewUserControl.cs index 8f0b35a4b..8653a1e08 100644 --- a/src/Orchard/Mvc/ViewUserControl.cs +++ b/src/Orchard/Mvc/ViewUserControl.cs @@ -67,24 +67,7 @@ namespace Orchard.Mvc { } public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { - 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; - } - + var metaEntry = new MetaEntry(name, content, httpEquiv, charset); SetMeta(metaEntry); } diff --git a/src/Orchard/UI/Resources/MetaEntry.cs b/src/Orchard/UI/Resources/MetaEntry.cs index d492f2f10..639bb39b2 100644 --- a/src/Orchard/UI/Resources/MetaEntry.cs +++ b/src/Orchard/UI/Resources/MetaEntry.cs @@ -5,6 +5,29 @@ using System.Web.Mvc; namespace Orchard.UI.Resources { public class MetaEntry { private readonly TagBuilder _builder = new TagBuilder("meta"); + + public MetaEntry() { + + } + + public MetaEntry(string name = null, string content = null, string httpEquiv = null, string charset = null) { + if (!String.IsNullOrEmpty(name)) { + Name = name; + } + + if (!String.IsNullOrEmpty(content)) { + Content = content; + } + + if (!String.IsNullOrEmpty(httpEquiv)) { + HttpEquiv = httpEquiv; + } + + if (!String.IsNullOrEmpty(charset)) { + Charset = charset; + } + + } public static MetaEntry Combine(MetaEntry meta1, MetaEntry meta2, string contentSeparator) { var newMeta = new MetaEntry();