HTML Head Elements - Mura Docs v6

HTML Head Elements

You can find a number of useful template variables and code snippets on the file located under /default/includes/themes/MuraBootstrap3/templates/inc/html_head.cfm

Meta Description

#$.content('metaDesc')#

Outputs text entered into the Meta Description field on the SEO tab when editing a content item.

Usage

<meta name="description" content="#esapiEncode('html_attr', $.content('metaDesc'))#" />

Meta Keywords

#$.content('metaKeywords')#

Outputs text entered into the Meta Keywords field on the SEO tab when editing a content item.

Usage

<meta name="keywords" content="#esapiEncode('html_attr', $.content('metaKeywords'))#" />

Credits

#$.content('credits')#

Outputs the text entered into the Credits field found on the Publishing tab when editing a content item.

Usage

<cfif len($.content('credits'))>
<meta name="author" content="#esapiEncode('html_attr', $.content('credits'))#" />
</cfif>

Mura Version

#$.globalConfig('version')#

Outputs which specific version of Mura the current instance is running on.

Usage

<meta name="generator" content="Mura CMS #$.globalConfig('version')#" />

HTML (Browser) Title

#$.content('HTMLTitle')#
#$.siteConfig('site')#

Outputs the HTML (Browser) Title from the SEO tab (when editing a content item) and the Site Name entered under Site Config > Edit Site.

Usage

<title>#esapiEncode('html', $.content('HTMLTitle')# - #esapiEncode('html', $.siteConfig('site'))#</title>

Favicon

<link rel="icon" href="#$.siteConfig('assetPath')#/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="#$.siteConfig('assetPath')#/images/favicon.ico" type="image/x-icon" />

Outputs a link to a favicon file included in site's "images" directory. Declaring both allows consistent output across browsers while overriding the default location in the root of a Mura install. This also allows each Mura site to have a unique favicon.

Path Variables

Mura can auto-generate the absolute paths to either the "site" or "theme" directory. The paths also include the context. For example, if Mura is installed under a subdirectory of your webroot, it would include the directory or directories where Mura resides.

Site Asset Path

$.siteConfig('assetPath')

Outputs {context}/{SiteID}

Theme Asset Path

$.siteConfig('themeAssetPath')

Outputs {context}/{SiteID}/includes/themes/{ThemeName}

These are two of the most commonly used template variables used by theme developers. You will use these to make appropriate link references to assets such as your JavaScript and CSS files. For example, the following line of code would generate an absolute link to your theme's CSS file:

<link rel="stylesheet" href="#$.siteConfig('themeAssetPath')#/css/theme/theme.min.css">

Alternate Content (RSS)

Dynamically loops through all Content Collections/Local Indexes and outputs links to all "public" RSS feeds created. When present, some browsers may show an RSS icon in the location field to indicate RSS feeds are available.

<cfset rs=$.getBean('feedManager').getFeeds($.event('siteID'),'Local',true,true) />

<cfloop query="rs">
<link rel="alternate" type="application/rss+xml" title="#esapiEncode('html_attr', $.siteConfig('site'))# - #esapiEncode('html_attr', rs.name)#" href="#esapiEncode('html_attr', 'http://#listFirst(cgi.http_host,":")##$.globalConfig('context')#/tasks/feed/?feedID=#rs.feedID#')#" />
</cfloop>

Site ID

$.siteConfig('siteID')

Outputs the Site ID found under Site Config > Edit Site. This makes it possible to make any reference to the site id to be "site-independent."

Site Name

$.siteConfig('site')

Outputs the Site Name found under Site Config > Edit Site.

Link to Content

When you need to dynamically create a link to any content within the site, you can use this standard syntax:

$.createHREF(filename='')

If you leave the filename empty, it will create a link to the Home page. The "filename" of any content item can be found on the Advanced tab of the Edit Content screen.

Usage

$.createHREF(filename='about-us/board-of-directors')