Interface ICmsSite
The site context of the code - so basically which website / portal it's running on.
🪒 In Dynamic Razor it's found on CmsContext.Site
🪒 In Typed Razor it's found on MyContext.Site
Namespace: ToSic.Sxc.Context
Assembly: ToSic.Sxc.dll
Syntax
[PublicApi]
public interface ICmsSite : IHasMetadata
Properties
| Improve this Doc View SourceId
The Id of the site in systems like DNN and Oqtane.
🪒 Use in Dynamic Razor: CmsContext.Site.Id
🪒 Use in Typed Razor: MyContext.Site.Name
Declaration
int Id { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
In DNN this is the same as the PortalId
Metadata
Metadata of the current site
Declaration
IMetadata Metadata { get; }
Property Value
Type | Description |
---|---|
IMetadata |
Remarks
Added in v13.12
Url
The site url with protocol. Can be variation of any such examples:
- https://website.org
- https://www.website.org
- https://website.org/products
- https://website.org/en-us
- https://website.org/products/en-us
🪒 Use in Dynamic Razor: CmsContext.Site.Url
🪒 Use in Typed Razor: MyContext.Site.Url
Declaration
string Url { get; }
Property Value
Type | Description |
---|---|
string |
UrlRoot
The url root which identifies the current site / portal as is. It does not contain a protocol, but can contain subfolders. This is mainly used to clearly identify a site in a multi-site system or a language-variation in a multi-language setup.
🪒 Use in Dynamic Razor: CmsContext.Site.UrlRoot
🪒 Use in Typed Razor: MyContext.Site.UrlRoot
Declaration
string UrlRoot { get; }
Property Value
Type | Description |
---|---|
string |
Remarks
introduced in 2sxc 13