Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
canhn32847157Accepted solution
Level 2
Feb 28, 2017 8:29 AM UTC

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
Level 4
Feb 22, 2017 3:21 PM UTC

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.

Translate
kautuk_sahni
Level 9
Feb 23, 2017 5:36 AM UTC

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

~kautuk

Translate
Kautuk Sahni
Feb 23, 2017 1:47 PM UTC

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'} " />
Translate
daniel_henriqu1
Level 4
Feb 23, 2017 2:06 PM UTC

@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.

Translate
Feike_Visser1
Adobe Employee
Adobe Employee
Feb 23, 2017 5:30 PM UTC

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

Translate
kautuk_sahni
Level 9
Feb 24, 2017 5:18 AM UTC

Hi 

Please confirm if the experts suggestion help you here.

~kautuk

Translate
Kautuk Sahni
canhn32847157AuthorAccepted solution
Level 2
Feb 28, 2017 8:29 AM UTC

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,

Translate