Adding hyperlinks to titles

Solved
Highlighted
New Member
3 0 0

Hi there,

 

I' have two collections on my homepage: 'women's t-shirts' and 'men's t-shirts'.  I want to hyperlink the title of these featured collections to the correct collection page.

 

I have used the code below to add a hyperlink to the title, but it means both of the collections on my homepage link to the 'men's t-shirts' collection. I want the women's collections to link to women's shirts.

 

How do I single out the title 'women's t-shirts' to link to the correct collection?

 

Help much appreciated!

 

 

<div class="index-section home-section feature-collection feature-collection--{{ section.id }}" data-section-id="{{ section.id }}" data-section-type="feature-collection">
<div class="wrapper wrapper--margins bottom--space">
  
    {%- assign collection = collections[section.settings.collection] -%}

    {% if section.settings.heading != blank %}
      {% if section.settings.show_view_all %}
        <div class="grid">
          <div class="grid__item large--three-quarters small--one-whole medium--one-whole">
      {% endif %}
      <h2 class="home-section-title"> 
        <a href="{{ "https://bornhybrid.com/collections/mens-eco-t-shirts" }}">
          {{ section.settings.heading | escape }}</h2>
      {% if section.settings.show_view_all %}
        </div> 
          <div class="grid__item large--one-quarter small--one-whole medium--one-whole text-right medium-down--text-center view-all">
            <a href="https://bornhybrid.com/collections">
              <span>{{ 'collections.general.view_all' | t }}</span>
              {% include "asset_svg" with "arrow_right" %}</a>

 

0 Likes
Highlighted

Success.

Shopify Expert
3305 526 775

Hi,

Change your code to bellow:

 

<a href="{{ collection.url }}">

Let me know if you need help.

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
1 Like
Highlighted
New Member
3 0 0

Amazing, thank you so much Jasoliya! Really appreciate your help :)

0 Likes
Highlighted
New Member
1 0 0

Hi Jasoliya, I am using debut theme and have a number of featured collections on my home page that I would like to hyperlink the titles of ?

 

Is this possible and if so would you perhaps mind explaining it to me? 

 

Many thanks,

0 Likes
Highlighted
New Member
2 0 1

Hi, where do I paste the code? Also do I change both <a href> in the code? Thanks.

0 Likes
Highlighted
Shopify Expert
3305 526 775

You can add this link in your featured collection section with title:

<a href="{{ collection.url }}">{{ collection.title }}</a>

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Highlighted
Tourist
11 0 0

Hi, where can I paste this in my simple theme ?

 

At the moment, it looks like this :

 

 <div class="feature-row">
      {% if section.settings.layout == 'left' %}
        {{ image_layout }}
      {% endif %}

      <div class="feature-row__item feature-row__text feature-row__text--{{ section.settings.layout }}">
        {% if section.settings.title != blank %}
          <h2 class="small--text-center">{{ section.settings.title | escape }}</h2>
        {% endif %}
        {% if section.settings.text != blank %}
          <div class="rte-setting featured-row__subtext">{{ section.settings.text }}</div>
        {% endif %}
        {% if section.settings.button_label != blank and section.settings.button_link != blank %}
          <a href="{{ section.settings.button_link }}" class="btn">
            {{ section.settings.button_label | escape }}
          </a>
        {% endif %}
      </div>
0 Likes
Highlighted
Shopify Expert
3305 526 775

I think you have below is for title:

 <h2 class="small--text-center">{{ section.settings.title | escape }}</h2>

So if its collection page then make it like:

 <a href="{{ collection.url }}"> <h2 class="small--text-center">{{ section.settings.title | escape }}</h2> </a>

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes