Search code examples
htmlxmlaem

I can't get an attribute to show up in my anchor tag


I need to get rel="" into this html. This is part of AEM, so I have an xml file doing this:

content.xml

<rel
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="HTML attribute to apply to the component."
fieldLabel="Rel"
name="./rel"/>

I've tried just duplicating how id is handled, along with a million other things...

button.html

<button 
    data-sly-use.button="com.adobe.cq.wcm.core.components.models.Button" 
    data-sly-element="${button.buttonLink.valid ? 'a' : 'button'}" 
    type="${button.buttonLink.valid ? '' : 'button'}" 
    id="${button.id}" 
    rel="${button.rel}"   <--THIS DOES NOT WORK
    class=""
    data-sly-attribute="${button.buttonLink.htmlAttributes}" 
    aria-label="${button.accessibilityLabel}" 
    data-cmp-clickable="${button.data ? true : false}" 
    data-cmp-data-layer="${button.data.json}">
    <span data-sly-test="${button.text}" class="">${button.text}</span>
</button>

Solution

  • this was the answer

    rel=${properties.rel}