Skip to main content

Razor Blade Tutorials

Tutorial HomeRazor.Blade

RazorBlade add Open-Graph Headers

This page sets various open-graph headers. 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 add Open-Graph Headers... <!-- unimportant stuff, hidden -->

@{#if NETCOREAPP}
  @Html.Partial("../shared/_MessageOqtaneDisabled.cshtml")
@{#else}
@{
  // note: 'og:' is auto-prefixed if not given in the key
  HtmlPage.AddOpenGraph("title", "Demo of OpenGraph headers");
  HtmlPage.AddOpenGraph("type", "website");
}
@{#endif}

<!-- unimportant stuff, hidden -->