• Home
  • Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • ToSic.Razor.Blade
      • HtmlPage
      • IHtmlTag
      • IHtmlTagService
      • IScrub
      • ITag
      • Tag
      • Tags
      • Text
    • ToSic.Razor.Html5
      • A
      • Abbr
      • Address
      • Area
      • Article
      • Aside
      • Audio
      • B
      • Base
      • Bdi
      • Bdo
      • Blockquote
      • Br
      • Button
      • Canvas
      • Caption
      • Cite
      • Code
      • Col
      • Colgroup
      • Comment
      • Data
      • Datalist
      • Dd
      • Del
      • Details
      • Dfn
      • Dialog
      • Div
      • Dl
      • Dt
      • Em
      • Embed
      • Fieldset
      • Figcaption
      • Figure
      • Footer
      • Form
      • H1
      • H2
      • H3
      • H4
      • H5
      • H6
      • Head
      • Header
      • Hr
      • I
      • Icon
      • Iframe
      • Img
      • Input
      • Ins
      • Kbd
      • Label
      • Legend
      • Li
      • Link
      • Main
      • Map
      • Mark
      • Meta
      • MetaOg
      • Meter
      • Nav
      • Noscript
      • Object
      • Ol
      • Optgroup
      • Option
      • Output
      • P
      • Param
      • Picture
      • Pre
      • Progress
      • Q
      • Rp
      • Rt
      • Ruby
      • S
      • Samp
      • Script
      • ScriptJsonLd
      • Section
      • Select
      • Small
      • Source
      • Span
      • Strong
      • Style
      • Sub
      • Summary
      • Sup
      • Svg
      • Table
      • Tbody
      • Td
      • Template
      • Textarea
      • Tfoot
      • Th
      • Thead
      • Time
      • Tr
      • Track
      • U
      • Ul
      • Var
      • Video
      • Wbr
    • ToSic.Razor.Markup
      • Attribute
      • AttributeBase
      • AttributeList
      • AttributeListBase
      • AttributeOptions
      • ChildTags
      • Tag<T>
      • TagBase
      • TagCustom
      • TagList
      • TagOptions
    • ToSic.Razor.StartUp
      • StartUp

    Class HtmlPage

    Access the surrounding page and read/modify some properties, and add various kinds of headers to the <head> of the current page.

    Inheritance
    System.Object
    HtmlPage
    Namespace: ToSic.Razor.Blade
    Assembly: ToSic.Razor.Dnn.dll
    Syntax
    [Obsolete("This used to be a good idea, but doesn't scale well with blazor. Please use the newer ToSic.Sxc.Web.IPageService instead.")]
    public static class HtmlPage
    Remarks

    This is now obsolete. The concept doesn't scale with Blazor (.net core), so we recommend you use the newer ToSic.Sxc.Web.IPageService instead.

    Properties

    | Improve this Doc View Source

    Description

    Get/Set description of this page Will return null if not running in a page context.

    Declaration
    public static string Description { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Keywords

    Get/Set keywords of this page Will return null if not running in a page context.

    Declaration
    public static string Keywords { get; set; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Title

    The current page title Will return null if not running in a page context.

    Declaration
    public static string Title { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    AddBase(String)

    Add a standard base header tag. new in 3.0

    Declaration
    public static void AddBase(string url = null)
    Parameters
    Type Name Description
    System.String url

    the optional url for the base tag - if null, will default to the real url for the current page

    | Improve this Doc View Source

    AddIcon(String, String, String, Int32, String)

    Add an icon tag to the page new in 3.0

    Declaration
    public static void AddIcon(string path, string doNotRelyOnParameterOrder = "Dummy-Parameter - don't provide this, but do name all other parameters in this call using paramName: value", string rel = "", int size = 0, string type = null)
    Parameters
    Type Name Description
    System.String path

    Path to the image/icon file

    System.String doNotRelyOnParameterOrder

    This is a dummy parameter to force the developer to name the remaining parameters - like size: 75 etc. This allows us to add more parameters in future without worrying that existing code could break.

    System.String rel

    the rel-text, default is 'icon'. common terms are also 'shortcut icon' or 'apple-touch-icon'

    System.Int32 size

    Will be used in size='#x#' tag; only relevant if you want to provide multiple separate sizes

    System.String type

    An optional type. If not provided, will be auto-detected from known types or remain empty

    | Improve this Doc View Source

    AddIconSet(String, String, Object, IEnumerable<String>, IEnumerable<Int32>)

    Add a set of icons to the page new in 3.0

    Declaration
    public static void AddIconSet(string path, string doNotRelyOnParameterOrder = "Dummy-Parameter - don't provide this, but do name all other parameters in this call using paramName: value", object favicon = null, IEnumerable<string> rels = null, IEnumerable<int> sizes = null)
    Parameters
    Type Name Description
    System.String path

    Path to the image/icon file

    System.String doNotRelyOnParameterOrder

    This is a dummy parameter to force the developer to name the remaining parameters - like size: 75 etc. This allows us to add more parameters in future without worrying that existing code could break.

    System.Object favicon

    path to favicon, default is '/favicon.ico'

    System.Collections.Generic.IEnumerable<System.String> rels
    System.Collections.Generic.IEnumerable<System.Int32> sizes
    | Improve this Doc View Source

    AddJsonLd(Object)

    Add a JSON-LD header according https://developers.google.com/search/docs/guides/intro-structured-data

    Declaration
    public static void AddJsonLd(object jsonObject)
    Parameters
    Type Name Description
    System.Object jsonObject

    A object which will be converted to JSON. We recommend using dictionaries to build the object.

    | Improve this Doc View Source

    AddJsonLd(String)

    Add a JSON-LD header according https://developers.google.com/search/docs/guides/intro-structured-data

    Declaration
    public static void AddJsonLd(string jsonString)
    Parameters
    Type Name Description
    System.String jsonString

    A prepared JSON string

    | Improve this Doc View Source

    AddMeta(String, String)

    Add a standard meta header tag. If you need to add more attributes, use AddHeader(...) instead

    Declaration
    public static void AddMeta(string name, string content)
    Parameters
    Type Name Description
    System.String name
    System.String content
    | Improve this Doc View Source

    AddOpenGraph(String, String)

    Add an open-graph header according to http://ogp.me/

    Declaration
    public static void AddOpenGraph(string property, string content)
    Parameters
    Type Name Description
    System.String property

    Open Graph property name, like title or image:width. 'og:' is automatically prefixed if not included

    System.String content

    value of this property

    | Improve this Doc View Source

    AddToHead(String)

    Add a tag to the header of the page Will simply not do anything if an error occurs, like if the page object doesn't exist

    Declaration
    public static void AddToHead(string tag)
    Parameters
    Type Name Description
    System.String tag
    | Improve this Doc View Source

    AddToHead(TagBase)

    Add a tag object to the header of the page Will simply not do anything if an error occurs, like if the page object doesn't exist

    Declaration
    public static void AddToHead(TagBase tag)
    Parameters
    Type Name Description
    TagBase tag
    Remarks

    New in 2.1

    | Improve this Doc View Source

    GetPage()

    Declaration
    public static IHtmlPage GetPage()
    Returns
    Type Description
    ToSic.Razor.Interfaces.IHtmlPage
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX