Gavin Wood
Gavin Wood

Reputation: 1004

AEM anchor tag stripped out in locahost

When I use an anchor tag without an href="" all is good and the button style is there, the second a add an href it completely removes the anchor tag and leave only the text inside the parent div

without href:

<div class="container">
 <a class="button"> my button</a>
</div>

result in browser devtools

<div class="container">
 <a class="button"> my button</a>
</div>

with href

<div class="container">
 <a  href="/content/mypage.html" class="button"> my button</a>
</div>

result in browser

<div class="container">
 my button
</div>

Upvotes: 1

Views: 390

Answers (2)

Raphael Schweikert
Raphael Schweikert

Reputation: 18556

Looks like this could be the work of the link checker. Try adding x-cq-linkchecker="skip":

<div class="container">
 <a x-cq-linkchecker="skip" href="/content/mypage.html" class="button"> my button</a>
</div>

Upvotes: 2

Andrey Shilov
Andrey Shilov

Reputation: 66

I guess it might be also related to xssconfig

as you add 'href' attribute to div in your example

<div  href="/content/mypage.html" class="container">
 <a class="button"> my button</a>
</div>

In general it is not allowed, therefore AEM can remove it /libs/cq/xssprotection/config.xml

Upvotes: 0

Related Questions