How to create a link for metaobject detail page in vacancies section?

Solved

How to create a link for metaobject detail page in vacancies section?

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

Replies 2 (2)

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>
PhilippePasquin
Shopify Partner
3 0 0

Thank you for this solution! Any workaround for localized entries?

I tried 

{{request.host}}{{project.system.url}}

which works fine but it's the relative path only


Philippe Pasquin
Shopify Partners & Shopify Expert

mobilePhone +1 438-793-8795
emailAddress p@pasquin.ca
website pasquin.ca
address 1206-1740 Rue St-Patrick, Montréal, QC


facebook
linkedin
Planifier un appel
Référez un client et recevez 200$*