Logo
Logo
  • Blazor CMS Home
  • Oqtane Tutorials
  • Blazor CMS Home
  • Oqtane Tutorials
Oqtane Tutorials
Oqtane Tutorials

Razor Page Service Tutorials

Tutorial Home › Razer Page Service
Safely Linking URLs with Umlauts and similar
#1 Set Page Title, Keywords, Descriptions etc.
Set <base> tag in header
Requirements
  • 2sxc 12.08
Resources
  • PageService
  • PageService API

IPageService To set Title, Description and Keywords

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

Kit.Page gets the Page Service on newer Razors

This tutorial inherits from the Custom.Hybrid.Razor14 or the Custom.Hybrid.RazorTyped base class.

This allows us to use Kit.Page to access an IPageService without having to use GetService<IPageService>.

@inherits Custom.Hybrid.RazorTyped

@{
  // prefix the current title, description and keywords with additional values
  Kit.Page.SetTitle("Title changed from the razor using Razor Blade! original: ");

  // Descriptions
  Kit.Page.SetDescription("Learn to use Razor Blade ");
  // If multiple Descriptions are added, they are pre-pended.
  // Reasoning is that if eg. the page first adds a description, and a module adds a description, the modules description will be more relevant.
  Kit.Page.SetDescription("Json LD Tutorial - "); 

  // Keywords
  Kit.Page.SetKeywords("2sxc, Tutorial, KeywordSet1");
}

Output is Invisible as it only affects the HTML Head

This sample modifies the HTML head, so it's not visible here. 

To see the effect, look at the source in the browser

 

Safely Linking URLs with Umlauts and similar
#1 Set Page Title, Keywords, Descriptions etc.
Set <base> tag in header
  • 2sic internet solutions
  • Langäulistrasse 62, 9470 Buchs SG, Switzerland
  • +41 81 750 67 77
Login