@@ -77,7 +78,7 @@ /** * Logger. */ - private static Logger log = LoggerFactory.getLogger(AHref.class); + private static final Logger log = LoggerFactory.getLogger(AHref.class); /** * href part that is added before the nodeData content. @@ -174,6 +175,7 @@ /** * @see javax.servlet.jsp.tagext.Tag#doEndTag() */ + @Override public int doEndTag() { if (StringUtils.isEmpty(this.templateName)) { if (this.nodeDataName == null) { @@ -211,7 +213,9 @@ startPage = Resource.getCurrentActivePage().getAncestor(this.level); HierarchyManager hm = MgnlContext.getHierarchyManager(ContentRepository.WEBSITE); Content resultPage = hm.getPage(startPage.getHandle(), this.templateName); - this.writeLink(resultPage.getHandle()); + String handle = resultPage.getHandle(); + String link = handle2link(handle); + this.writeLink(link); } catch (RepositoryException e) { log.error(e.getMessage()); @@ -221,6 +225,15 @@ return EVAL_BODY_BUFFERED; } + String handle2link(String handle) { + String link = I18nContentSupportFactory.getI18nSupport().toI18NURI(handle); + if(StringUtils.isEmpty(link)) { + String extension = "." + ServerConfiguration.getInstance().getDefaultExtension(); + link = "/index"+extension; + } + return link; + } + /** * Write a link. * @param path link path