Freemarker Variable Reference Guide

By default, FreeMarker templates have access to several variables defined in init.ftl that you can use in your themes to access several theme objects, settings, and resources. Several of these variables are listed below for reference:

Common Variables

VariableDescription
theme_displayReturns the themeDisplay Java Object and all its methods
portlet_displayReturns the portletDisplay Java Object and all its methods
layoutSetReturns the page set
theme_timestampPrints the date in the current locale with the given format
theme_settingsRetrieves theme settings. See configurable theme settings for more information.
root_css_classReturns the root CSS class which indicates the direction of the page (ltr (left-to-right) by default)
css_classReturns a string of the current classes applied to the body of the page
page_groupRetrieves the page group
css_folderReturns the path to the theme’s css folder
images_folderReturns the path to the theme’s images folder
javascript_folderReturns the path to the theme’s javascript folder
templates_folderReturns the path to the theme’s templates folder
full_css_pathReturns the full path, which includes the servlet context, to the theme’s css
full_templates_pathreturns the full path, which includes the servlet context, to the theme’s templates
css_main_fileReturns the path to main.css
js_main_fileReturns the path to main.js
company_idReturns the company ID
company_nameReturns the company name
company_logoReturns the company logo’s URL
company_logo_heightReturns the company logo’s height
company_logo_widthReturns the company logo’s width
company_urlReturns the URL of the home page for the company
time_zoneReturns the time zone for the current user
is_login_redirect_requiredReturns whether a login redirect is required for the user
is_signed_inReturns whether the user is signed in
group_idReturns the group ID for the current user
time_zoneReturns the time zone for the current user
is_default_userReturns if the user has a default role
is_femaleReturns if the current user is Female
is_maleReturns if the current user is Male
is_setup_completeReturns whether the user has configured their profile
languageReturns the native language for the current user
language_idReturns the ID of the current locale
user_birthdayReturns the current user’s birthday
user_commentsReturns comments from the user’s profile
user_email_addressReturns the user’s email address
user_first_nameReturns the user’s first name
user_greetingReturns the user’s greeting
user_idReturns the ID of the current user
user_last_login_ipReturns the IP address that the user last logged in from
user_last_nameReturns the last name of the current user
user_login_ipReturns the current user’s current IP address
user_middle_nameReturns the user’s middle name
user_nameReturns the current user’s username
w3c_language_idReturns the W3C language code of the current language

URLs

VariableDescription
show_control_panelReturns whether the current user has permission to view the Control Panel
control_panel_textReturns the “control-panel” language key in the current user’s locale, if they have permission to view the Control Panel
control_panel_urlReturns the URL to the Control Panel, if the current user has permission to view the Control Panel
show_homeReturns whether the current user is on a page
home_textReturns the “home” language key in the current user’s locale
home_urlReturns the URL to the home page
show_my_accountReturns whether the current user’s account icon is visible
my_account_textReturns the “my-account” language key in the current user’s locale, if the user’s account icon is visible
my_account_urlReturns the URL to the user’s Account Settings page if the user’s account icon is visible
show_sign_inReturns whether the sign in link is visible
sign_in_textReturns the “sign-in” language key in the current user’s locale, if they are signed out
sign_in_urlReturns the sign in URL, if the current user is signed out
show_sign_outReturns whether the sign out link is visible
sign_out_textReturns the “sign-out” language key in the current user’s locale, if they are signed in
sign_out_urlReturns the sign out URL, if the current user is signed in

Page

VariableDescription
the_titleReturns the current page’s title
selectableReturns whether the current page is selectable
is_maximizedReturns whether the page is maximized
pageReturns the current page (layout)
is_first_childReturns whether the current page is the first child page in the navigation
is_first_parentReturns whether the current page is the first parent page in the navigation
is_portlet_pageReturns whether the current page is a widget page (portlet)
site_nameReturns the site’s name
is_guest_groupReturns whether the current page group is for guests
site_typeReturns the type of the current site: site, company site, organization site, or user site
site_default_urlReturns the default URL for the site
layout_friendly_urlReturns the friendly URL of the current page
portlet_idReturns the portlet ID for the specified portlet

Logo

VariableDescription
logo_css_classReturns a string of the current classes applied to the logo.
use_company_logoReturns whether the logo is displayed
site_logo_heightReturns the logo’s height
site_logo_widthReturns the logo’s width
show_site_name_supportedReturns whether the logo is configured to show the site name. The value is true if show_site_name_default is true.
show_site_name_defaultReturns whether the Show Site Name Default theme setting is enabled
show_site_nameReturns whether the showSiteName property for the current pageset is enabled
logo_descriptionReturns the Site’s name or nothing if show_site_name is enabled. It is used for alternate text for the logo by default.

Navigation

VariableDescription
has_navigationReturns whether navigation exists (i.e. at least one page exists)
nav_itemsReturns the current pages as list
nav_css_classReturns a string of the current classes applied to the page’s navigation

My Sites

VariableDescription
show_my_sitesReturns whether the current user has a My Sites page
show_my_placesReturns whether the current user has a My Sites page
my_sites_textReturns the “my-sites” language key in the current user’s locale
my_places_textReturns whether the current user has a My Sites page

Includes

VariableDescription
dir_includeReturns “/html”
body_bottom_includeReturns “$/common/themes/body_bottom.jsp”
body_top_includeReturns “$/common/themes/body_top.jsp”
bottom_includeReturns “$/common/themes/bottom.jsp”
top_head_includeReturns “$/common/themes/top_head.jsp”
top_messages_includeReturns “$/common/themes/top_messages.jsp”

Date

VariableDescription
dateGives access to the dateUtil Java Object and all its methods
current_timeReturns the current time
the_yearReturns the current year
« Theme Anatomy Reference GuideIntroduction to Gradle Plugins »
¿Fue útil este artículo?
Usuarios a los que les pareció útil: 1 de 3