The site object

The site object represents a content site.


id

Returns the site id.

Syntax:

id → number

Returns:

The site id.

Example:

The following code outputs the site id:

<p>The site id is ${liquidsite.site.id?c}.</p>

Which will output something like:

<p>The section id is 1234.</p>

name

Returns the site name.

Syntax:

name → string

Returns:

The site name.

Example:

The following code prints the site name:

The site name is ${liquidsite.site.name}

revision

Returns the site revision number.

Syntax:

revision → number

Returns:

The site revision number, or zero (0) if the current revision is a work revision.

Example:

The following code prints the site revision number:

The site revision is ${liquidsite.site.revision}

created

Returns the site creation date.

Syntax:

created → date

Returns:

The site creation date.

Example:

The following code prints the site creation date:

The site creation date is ${liquidsite.site.created}

date

Returns the site revision date.

Syntax:

date → date

Returns:

The site revision date.

Example:

The following code prints the site revision date:

The site revision date is ${liquidsite.site.date}

online

Returns the site online flag.

Syntax:

online → boolean

Returns:

True if the site is online, false otherwise.

Example:

The following code checks if the site is online:

<#if liquidsite.site.online>
    Online
<#else>
    Offline
</#if>

lock

Returns the site lock object.

Syntax:

lock → lock object

Returns:

The site lock object.

Example:

The following code stores the lock object in a variable:

<#assign lock = liquidsite.site.lock>

user

Returns the site revision author.

Syntax:

user → user object

Returns:

The site revision author.

Example:

The following code stores the revision author in a variable:

<#assign user = liquidsite.site.user>

protocol

Returns the site protocol name. This string is identical to the protocol specified in the URL, i.e. "http" or "https".

Syntax:

protocol → string

Returns:

The site protocol name.

Example:

The following code prints the site protocol name:

The site protocol name is ${liquidsite.site.protocol}

host

Returns the site host name. Note that if this site has a default host name, the current request host name will be returned.

Syntax:

host → string

Returns:

The site or request host name.

Example:

The following code prints the site host name:

The site host name is ${liquidsite.site.host}

port

Returns the site port number. Note that if this site has a default port number, the current request port number will be returned.

Syntax:

host → number

Returns:

The site or request port number.

Example:

The following code prints the site port number:

The site port number is ${liquidsite.site.port?c}

directory

Returns the site root directory path.

Syntax:

directory → string

Returns:

The site root directory path.

Example:

The following code prints the site root directory:

The site root directory is ${liquidsite.site.directory}

admin

Returns the administration site flag.

Syntax:

admin → boolean

Returns:

True if the site is an administration site, or false otherwise.


hasAccess

Checks if the current user has a specified access permission to the site. The permission types available are:

Syntax:

hasAccess(permission) → boolean

Parameters:

Returns:

True if the current user has the specified permission, or false otherwise.

Example:

The following code checks if the current user has write access to a site:

<#if liquidsite.site.hasAccess("write")>
  The current user has write access.
</#if>