Skip to main content

Razor Blade Tutorials

Tutorial HomeRazor.Blade

RazorBlade set Title, Description and other headers

This page sets the title, description, keywords and some manual tags to the header. Look at the resulting output-source to see the effect.

Source Code of this file

Below you'll see the source code of the file. Note that we're just showing the main part, and hiding some parts of the file which are not relevant for understanding the essentials.

@inherits Custom.Hybrid.Razor12
@using ToSic.Razor.Blade;
<!-- unimportant stuff, hidden -->
RazorBlade set Title, Description and... <!-- unimportant stuff, hidden -->
  // Note: this only works because we have @using ToSic.Razor.Blade on top
  // Again note that this only works in DNN and is not recommended any more - see warning
  HtmlPage.Title = "Title changed from the razor using Razor Blade! original: " + HtmlPage.Title;
  HtmlPage.Description = "Learn to use Razor Blade " + HtmlPage.Description;
  HtmlPage.Keywords = "Tutorial, Razor, Blade" + HtmlPage.Keywords;
  HtmlPage.AddToHead("<meta xyz>");
  HtmlPage.AddMeta("somename", "somevalue");

<!-- unimportant stuff, hidden -->