New Shopify Certification now available: Liquid Storefronts for Theme Developers

Get the link from a metaobject.

Solved
jtempelman
Shopify Partner
2 1 0

Hi all, 

I've got a new section/block where I show 3 metaobject form the vacancies type. 
This metaobject have fields, like title, content, featured image. 

Now what i want to create a link to the detail page of the vacancy, but I cant figure out how I get this.
Because I assign vacancies with shop.metaobjects.vacancies.values, vacancies.url is empty. If I delete .values at the end of the assign, all vacancies are empty. 
This is the code I use to loop trough the vacancies:

  {% when 'open_vacancies' %}
              {% assign vacancies = shop.metaobjects.vacancies.values %}
              {% for vacancy in vacancies %}
                <h3>{{ vacancy.vacancy_title }}</h3>
                <p>{{ vacancy.vacancy_excerpt }}</p>
                <a href="{{ vacancy.url }}">Bekijk vacature</a>
              {% endfor %}
            {% endcase %}
Accepted Solution (1)
jtempelman
Shopify Partner
2 1 0

This is an accepted solution.

Resolved:
You have target the system.url .

<a href="{{ vacancy.system.url }}">Bekijk vacature</a>

View solution in original post

Reply 1 (1)
jtempelman
Shopify Partner
2 1 0

This is an accepted solution.

Resolved:
You have target the system.url .

<a href="{{ vacancy.system.url }}">Bekijk vacature</a>