What is a Portal Theme?
Portal Themes are associated with projects and control everything about how the portal looks, from the HTML pages displayed by the portal to the CSS and image files to the XSLT used to convert XML source into HTML.
All portal themes have the same three top-level folders:
pages
static
xsl
The pages
folder
The pages
folder contains the Freemarker templates used to draw the application
pages required for all HARP portals to function. Within this folder, the following
template
files are required:
portal-home.ftl
- The portal homepage template.searchResults.ftl
- The search results template.viewer.ftl
- The page displaying a topic in the context of a DITA map.mapViewer.ftl
- The page displaying a map or standalone topic.filtered.ftl
- The page to display when a user attempts to access content that does not match the portal's metadata filters.
You're free to use the Freemarker <#include>
tag to break these pages
down into smaller reusable components, but these are the minimum templates required
for the
HARP portal to function.
The Freemarker template language allows the use of JSP tag libraries, of which HARP allows two:
- The JSP Standard Tag Library (JSTL).
- The HARP Portal tag library. Documentation to come.
To use a tag library, include code like the following at the top of the template file:
<#assign harp=JspTaglibs['http://www.titaniasoftware.com/harp/taglib'] /> <#assign c=JspTaglibs['http://java.sun.com/jsp/jstl/core'] />
The static
folder
The static
folder contains files, such as images and CSS or LESS
stylesheets.
Files in the `static` folder can be accessed from pages using the
themeFileUrl
tag from the HARP JSP tag library. For example, the
following tag can be used to address the file
/static/images/myImage.png
:
<img src="<@harp.themeFileUrl value="/images/myImage.png" />">
LESS Stylesheet Support
HARP natively supports CSS stylesheets written in LESS, which is a CSS-like language that provides
many convenience features, such as variables and reusable style sets, that make it
much
easier to author and manage than traditional CSS. Any file with a .less
extension will automatically be converted to CSS when it is requested by a page using
the
<@harp.themeFileUrl>
tag.
The xsl
folder
The HARP tag library includes a <@harp.content>
tag, which renders XML
content from a HARP project into a portal webpage, optonally transforming it with
an XSLT
stylesheet from the portal theme's xsl
folder.
The full functionality of the <@harp.content>
tag is outside the scope
of this document, but for now an example should suffice.
<@harp.content url=itemUrl contextUrl=contextHarpUrl xsl="/topic/topic.xsl" />
This content tag will render the topic identified by the url
attribute, as
it exists as a member of the map identified by the given contextUrl
attribute, and transform it to HTML using the /xsl/topic/topic.xsl
file
from the portal's theme.