Index: src/main/java/info/magnolia/cms/taglibs/util/SimpleNavigationTag.java =================================================================== --- src/main/java/info/magnolia/cms/taglibs/util/SimpleNavigationTag.java (revision 30475) +++ src/main/java/info/magnolia/cms/taglibs/util/SimpleNavigationTag.java (working copy) @@ -237,6 +237,15 @@ private boolean markFirstAndLastElement = false; /** + * Flag to allow HTML code when getting the display string from the "navTitle" field. HTML + * code should not be allowed when using the "title" field (or the node name) as source for + * the nav item display string since these fields are used in the first place for page + * titles and url path segments where no HTML code is allowed. Default is true meaning + * HTML code will be escaped (which was the behavior so far). + */ + private boolean escapeXmlInNavTitle = true; + + /** * The start level for navigation, defaults to 0. * @jsp.attribute required="false" rtexprvalue="true" type="int" */ @@ -346,6 +355,18 @@ markFirstAndLastElement = flag; } + /** + * Setting this flag to false will allow the HTML tags to be used in the navigation items display string, + * but only when the display string is read from the "navTitle" field. Default is "true" meaning HTML + * code will be escaped. + * @param escapeXmlInNavTitle the escapeXmlInNavTitle to set + * @jsp.attribute required="false" rtexprvalue="true" type="boolean" + */ + public void setEscapeXmlInNavTitle(boolean escapeXmlInNavTitle) { + this.escapeXmlInNavTitle = escapeXmlInNavTitle; + } + + public int doEndTag() throws JspException { Content activePage = Resource.getCurrentActivePage(); try { @@ -413,6 +434,7 @@ this.filter = null; this.nofollow = null; this.markFirstAndLastElement = false; + this.escapeXmlInNavTitle = true; super.release(); } @@ -574,7 +596,11 @@ out.print("<" + this.wrapperElement + ">"); //$NON-NLS-1$ } - out.print(StringEscapeUtils.escapeHtml(title)); + if (!escapeXmlInNavTitle && title.equals(nodeData.getString(StringUtils.EMPTY))) { + out.print(title); + } else { + out.print(StringEscapeUtils.escapeHtml(title)); + } if (StringUtils.isNotEmpty(this.wrapperElement)) { out.print(""); //$NON-NLS-1$