AEM 6.1 - Slightly | Community
Skip to main content
February 22, 2017
Solved

AEM 6.1 - Slightly

  • February 22, 2017
  • 7 replies
  • 2388 views

Hi guys,
How to handle
<meta name="description" content="${seoProps.description}" />
output:
<meta name="description" content="" />
Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by canhn32847157

Thanks all ! Sorry I didn't answer.

seoProps.description return String type.
if seoProps.description is empty, output is: content=""

I do it like this.

<meta name="description" content="${seoProps.description || true}">

output: <meta name="description" content />

Thanks,

7 replies

daniel_henriqu1
February 22, 2017

Hi.

Do you mean how to hide the tag if seoProps.description is null/empty?

Have you tried

<meta data-sly-test="${seoProps.description}" name="description" content="${seoProps.description}" />

?

HTL Test Statement

Regards,

Daniel.

kautuk_sahni
Community Manager
Community Manager
February 23, 2017

I think Daniel has provided you with correct answer. Please verify it.  

~kautuk

Kautuk Sahni
February 23, 2017

Daniel is right, and also dont forget to escape if the content has special characters.

<meta data-sly-test="${seoProps.description}" name="description" content="${seoProps.description @ context = 'scriptString'} " />
daniel_henriqu1
February 23, 2017

@Conexio Group, Sightly is smart enough to figure out which context to use, most of the time:

HTL Display Context

So, for regular attributes, I wouldn't add anything.

Regards,

Daniel.

Feike_Visser1
Adobe Employee
Adobe Employee
February 23, 2017

Only for style and script it is mandatory to specify the context.

kautuk_sahni
Community Manager
Community Manager
February 24, 2017

Hi 

Please confirm if the experts suggestion help you here.

~kautuk

Kautuk Sahni
canhn32847157AuthorAccepted solution
February 28, 2017

Thanks all ! Sorry I didn't answer.

seoProps.description return String type.
if seoProps.description is empty, output is: content=""

I do it like this.

<meta name="description" content="${seoProps.description || true}">

output: <meta name="description" content />

Thanks,