Skip to main content
Home  › ... Razor

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. Click to expand the code

@inherits Custom.Hybrid.Razor12
@using ToSic.Sxc.Services;
@using ToSic.Razor.Blade;
<!-- unimportant stuff, hidden -->
RazorBlade add Open-Graph Headers... <!-- unimportant stuff, hidden -->

@if(CmsContext.Platform.Name == "Oqtane") {
} else {
  var page = GetService<IPageService>();
  // note: 'og:' is auto-prefixed if not given in the key
  page.AddOpenGraph("title", "Demo of OpenGraph headers");
  page.AddOpenGraph("type", "website");

<!-- unimportant stuff, hidden -->