Skip to main content
arjuns71585267
Level 4
Sep 26, 2018 12:22 PM UTC
Solved

is it possible to add links in template

Hi Everyone,

I tried using <a href> tag inside my HTL page to add links i my aem template and it didn't work...

Any way to create hyperlinks?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
VeenaVikraman
VeenaVikramanAccepted solution
Community Advisor
Sep 26, 2018 1:22 PM UTC

Hi Arjun

    There could be chances that HTL might have filtered thinking it as invalid link. HTL has inbuilt XSS protection. Could you please provide a sample of the link or code you were trying ?

I have tried to pull few links from the web

Adobe AEM Sightly

12 replies

arunpatidar
Community Advisor
Community Advisor
Sep 26, 2018 2:15 PM UTC

Yes, It is possible but then how would you render dynamic/authorable content.

with the help of HTML, JS and CSS you can create static page but for dynamic page you have to use either JSP or HTL, and to choose between HTL and JSP, HTL has advantage over JSP.

Translate
Arun Patidar
errsheenah
Sep 26, 2018 2:17 PM UTC

Hi,

By adding the <a href> tag in your page html to which the template is referencing, it should show up on the template by default. Please check if the template has the proper sling:resourceType and the page node is of the correct structure.
Here's a screenshot for reference :

The blankpage.html that I have used to test this locally :

<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>

<div class="main-par">

<div data-sly-resource="${ @path='par', resourceType='wcm/foundation/components/parsys'}" data-sly-unwrap></div>

<a href="http://www.google.com">HI</a>

</div>

This gave me the following result :

As you can see both parsys and the link were rendered.

Hope this helps!

Translate