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
Set Page Title, Keywords, Descriptions etc.
#2 Set <base> tag in header
Page Icons for Favicon, Apple/Android
Requirements
  • 2sxc 12.08
Resources
  • IPageService SetBase(...)

Set <base> Tag in Header using the IPageService

This page sets the Base tag in the header. Look at the source of this page to see the result.
There are two ways to do this:

  • Kit.Page.SetBase() will auto-detect the current base. It's extra smart, so the result will also work on the home page of a portal.
  • Kit.Page.SetBase("/some/page") create the base tag with the specified url.

@inherits Custom.Hybrid.RazorTyped

@Kit.Page.SetBase()
@{
  // You can also set a custom base path
  // It's commented out here, as it would affect all the links on the page
  // Kit.Page.SetBase("../");

  // FYI: The output is invisible - it's just a <base> tag in the HTML header
}

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

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>.

 

Set Page Title, Keywords, Descriptions etc.
#2 Set <base> tag in header
Page Icons for Favicon, Apple/Android
  • 2sic internet solutions
  • Langäulistrasse 62, 9470 Buchs SG, Switzerland
  • +41 81 750 67 77
Login