Alexander Hein
Alexander Hein

Reputation: 990

How do I change the title-Attribut in Shopify's liquid?

Can someone explain me how do I change the title-Attribut here.

liquid code

 <ul class="material-nav">
    {% for tag in collection.all_tags %}
    {% if current_tags contains tag %}
    <li class="active">
    {{ tag | capitalize | link_to_tag: tag }}
    </li>
    {% else %}
    <li>
    {{ tag | capitalize | link_to_tag: tag }}
    </li>
    {% endif %}
    {% endfor %}
    </ul>

Output

 <ul class="material-nav">

     <li>
     <a title="Show products matching tag tag1" href="/collections/products/tag1">Tag1</a>
     </li>

     <li>
     <a title="Show products matching tag tag2" href="/collections/products/tag2">Tag2</a>
     </li>

     <li>
     <a title="Show products matching tag tag3" href="/collections/products/tag3">Tag3</a>
     </li>

  </ul>

Upvotes: 0

Views: 527

Answers (1)

Brian John
Brian John

Reputation: 599

I know that you can edit a link title on a normal link as follows:

{{ 'Foo Bar' | link_to: 'http://www.foobar.com', 'Foo Bar Title Here' }}

So it MAY stand to reason that you could try the following:

{{ tag | capitalize | link_to_tag: tag, 'Title Here' }}

No promises though, my friend. I have only built a couple liquid sites.

Upvotes: 1

Related Questions