In Liferay, Journal Structures play a crucial role in defining the layout and format of Liferay webcontent. An essential aspect of these structures is the use of reserved variables. These variables are predefined in Liferay’s codebase and offer a range of functionalities for developers and content managers. In this article, we’ll delve into some reserved variables, exploring their purposes and how they can be utilized in Liferay development.
Click here to learn Liferay Theme Development
Table of Contents
Reserved Variables in Liferay Journal Structures:
The ‘JournalStructureConstants
‘ class in Liferay’s ‘journal-API
‘ module defines several reserved variables. Here’s a breakdown of some key variables and their uses:
RESERVED_ARTICLE_ASSET_TAG_NAMES
: This variable handles asset tag names associated with the article. It’s crucial for categorization and search functionality.RESERVED_ARTICLE_AUTHOR_COMMENTS:
It stores comments made by the article’s author, providing context or additional information about the content.RESERVED_ARTICLE_AUTHOR_EMAIL_ADDRESS
: This variable holds the email address of the article’s author, useful for contact purposes or attribution.RESERVED_ARTICLE_AUTHOR_ID
: It represents the unique identifier of the article’s author, essential for tracking authorship across different articles.RESERVED_ARTICLE_AUTHOR_JOB_TITLE
: This variable contains the job title of the article’s author, adding a professional context to the content.RESERVED_ARTICLE_AUTHOR_NAME
: It stores the name of the article’s author, used for displaying author information alongside the article.RESERVED_ARTICLE_CREATE_DATE
: This variable represents the creation date of the article, important for content management and scheduling.RESERVED_ARTICLE_DISPLAY_DATE
: This variable indicates when the article was displayed, which can differ from the creation date.RESERVED_ARTICLE_DESCRIPTION
: It holds a brief description of the article, often used in previews or search results.RESERVED_ARTICLE_EXTERNAL_REFERENCE_CODE
: A unique code for external reference purposes, enhancing integration capabilities.RESERVED_ARTICLE_ID
: It’s the unique identifier for the article, crucial for database management and referencing.RESERVED_ARTICLE_MODIFIED_DATE
: This variable tracks when the article was last modified, important for version control.RESERVED_ARTICLE_RESOURCE_PRIM_KEY
: It represents the primary key for the article resource, essential for database operations.RESERVED_ARTICLE_SMALL_IMAGE_URL
: This variable stores the URL of a small image associated with the article, often used for thumbnails or previews.RESERVED_ARTICLE_TITLE
: It contains the title of the article, displayed in listings and headers.RESERVED_ARTICLE_URL_TITLE
: This variable holds a URL-friendly version of the article title, important for SEO and linking purposes.RESERVED_ARTICLE_VERSION
: It represents the version of the article, crucial for tracking changes and updates.
Integrating Reserved Variables in FTL and Velocity Templates in webcontent
In Liferay, FreeMarker and Velocity are popular templating engines used for rendering dynamic content. Understanding how to use reserved variables in these templates can greatly enhance your content’s flexibility and functionality.
Using Reserved Variables in FreeMarker (FTL)
FreeMarker, or FTL, is a template engine used in Liferay for dynamic content rendering. Here’s an example of how to use the ‘RESERVED_ARTICLE_TITLE
‘ variable in an FTL template in Liferay webcontent:
${.vars['reserved-article-create-date'].getData()}
Using Reserved Variables in Velocity
Velocity is another templating engine used in Liferay. Here’s how you can use the RESERVED_ARTICLE_TITLE
variable in a Velocity template:
$reserved-article-create-date.getData()
Conclusion
Understanding and utilizing these reserved variables can significantly enhance your Liferay development experience. They provide a standardized way to manage and display content, ensuring consistency and efficiency in your web content management. As a Liferay Frontend Developer, familiarizing yourself with these variables is a step towards mastering Liferay’s powerful content management capabilities.