We have a site (domain.com) that lives under /content/namespace/domain_com
I have url mappings that map domain.com to /content/namespace/domain_com
We want links when going to http://www.domain.com to be relative to that node, i.e domain.com/about.html
If I leave Link Checker enabled, it strips out my A tags, for instance my navigation looks like:
<li>About</li>
If I disabled Link Checker, it produces the links exactly as I expect them, for instance the navigation links look like:
<li><a href="https://forums.adobe.com/about.html">About</a></li>
Why is URL mappings breaking links?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
how do your generated links look like? if they are http://domain.com/about.html, the linkchecker will try to resolve them. And if it cannot be resolved, the link is removed. Your links within the site should be relative and should not contain any hostname.
kind regards,
Jrg
Views
Replies
Total Likes
Hi,
how do your generated links look like? if they are http://domain.com/about.html, the linkchecker will try to resolve them. And if it cannot be resolved, the link is removed. Your links within the site should be relative and should not contain any hostname.
kind regards,
Jrg
Views
Replies
Total Likes
Sounds like you have
If all are configured correctly file a support ticket to validate your settings.
Views
Replies
Total Likes
Thanks for the responses.
I assume my mappings are correct. Because when LinkChecker is disabled the links are generated correctly.
My links do not contain the hostname, and they are either generated with the entire JCR structure: /content/namsepace/domain_com/en/about.html (when not using URL mappings) or when using URL mappings that same link is generated like so: /en/about.html (if link checker is disabled).
Here is the code in the component that is generating the nav, it may show a potential problem? (using sightly & server side JS)
use(function () { var items = []; var root = currentPage.getAbsoluteParent(3); var currentNavPath = currentPage.getAbsoluteParent(3).getPath(); var it = root.listChildren(new Packages.com.day.cq.wcm.api.PageFilter()); var children = currentPage.listChildren(); //Used for getting global CTA link var someStyle = currentDesign.getStyle("page_home/site_globals"); var applyUrl = someStyle.get("call_to_action_url", "#"); if (children != null) { children = "dropdown" } else { children = ""; } while (it.hasNext()) { var page = it.next(); // No strict comparison, because the types returned from the Java APIs // don't strictly match the JavaScript types var selected = (page.getPath() == currentNavPath); items.push({ page: page, selected : selected, isDropdown : children }); } return { items: items, applyUrl: applyUrl }; });
I am then just inserting them like so via sightly:
<li class="dropdown"> <a href="${item.page.path}.html" class="dropdown-toggle" data-toggle="dropdown">${item.page.title} <span class="glyphicon glyphicon-triangle-bottom" aria-hidden="true"></span></a> <!--/* Template for children */--> <template data-sly-template.dropdown="${@ childPage}"> <ul class="dropdown-menu" data-sly-list="${childPage.listChildren}"> <li><a href="${item.path}.html">${item.title}</a></li> </ul> </template> <div data-sly-call="${dropdown@childPage=item.page}" data-sly-unwrap></div> </li>
Views
Replies
Total Likes
As temporary workaround add [1] into in the <a> tag. Later fix the code to use externalize api.
[1] x-cq-linkchecker="skip"
Views
Replies
Total Likes