Skip to content

Instantly share code, notes, and snippets.

@birksy89
Last active September 15, 2017 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save birksy89/c755fd83d0943b5ab94b to your computer and use it in GitHub Desktop.
Save birksy89/c755fd83d0943b5ab94b to your computer and use it in GitHub Desktop.
Dotnetnuke - Add Meta Tags to Head via Razor Files
//we add meta description
System.Web.UI.HtmlControls.HtmlMeta objMetaDescription = new System.Web.UI.HtmlControls.HtmlMeta();
objMetaDescription.Name = "DESCRIPTION";
objMetaDescription.Content = "This will be the meta description content";
DotNetNuke.Framework.CDefault tp = (DotNetNuke.Framework.CDefault)Context.CurrentHandler;
tp.FindControl("Head").Controls.Add(objMetaDescription);
@TheDeadlyBulb
Copy link

Thanks. I have been searching for this answer. It worked perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment