Monday, April 30, 2012

Liferay Web Content Tokens

I did not know that even without all the fancy macro/template/velocity stuff that Liferay Journals/Web Content can do, there is the ability to still insert some dynamic content based on stuff like the j2ee context root.

Examples (for mostly unmodified liferay 6.1 guest community content with liferay still deployed to /ROOT):
@company_id@: 10153
@friendly_url_current@: /web
@friendly_url_private_group@: /group
@friendly_url_private_user@: /user
@friendly_url_public@: /web
@group_friendly_url@: /guest
@group_id@: 10179
@image_path@: /image
@layout_set_friendly_url@: /web/guest
@main_path@: /c
@protocol@: http
@theme_image_path@: /my-custom-theme/images

Deprecated tokens

@friendly_url@: /web
@friendly_url_private@: /group
@page_url@: /web

I grabbed the list of tokens from instead of the wiki page.

On a side note, you still can't use the Liferay IDE with a non-ROOT j2ee context root yet.

1 comment:

Yaniv Rabl said...

You can also add in
# Set a list of custom tokens that will be replaced when article content is
# rendered. For example, if set to "custom_token_1", then "@custom_token_1@"
# will be replaced with its token value before an article is displayed.


and in the template use: