We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

h1 collection title metafield

h1 collection title metafield

ChrisW3
Trailblazer
284 1 20

Looking to use a custom metafield I created "metafields.custom.collectionh1" to display custom collection titles on collection pages. How do I do this?

 

Current code looks like this:

<header class="section-header">


{% if collection.url contains 'couches' %}<h1>{{ collection.title }}</h1>
{% elsif collection.url contains 'couch-accessories' %}<h1>{{ collection.title }}| Treatment Couches</h1>
{% elsif collection.url contains 'massage-table' %}<h1>{{ collection.title }} | Treatment Couches |</h1>
{% else %}
<h1 class="section-header--title h1">{{ collection.title }}</h1>
{% endif %}
<div class="rte rte--header">
{{ collection.description }}
</div>
</header>

 

 

https://www.physioworldshop.co.uk/collections/treatment-couches

Reply 1 (1)

kevinkarma55
Shopify Partner
101 11 11

hi,

replace following line

{% if collection.url contains 'couches' %}<h1>{{ collection.title }}</h1>

with following

{% if collection.url contains 'couches' %}<h1>{{ collection.metafields.custom.collectionh1 }}</h1>
Please remember to Like & Mark Solution to the post if it helped you.
Thanks !
If you'd like to support me, you can Buy Me a Coffee
Need help with anything related to Frontend?
Checkout kevinkarma.me