I have a metaobject called “brand” within a metafield “created_by” and I want to use the slug of the “name” key of the brand to create a link to the brand page template. Example link… https://www.beforeourtime.com/pages/brand/colors-greys
“colors & greys” is the name of a brand. This is the metaobject definition… https://snipboard.io
This is how I reference the brand name on my product page template…
{{ product.metafields.custom.created_by.value.name }}
Hi,
-
Create a Metafield–>Assign a Value(This value could be a string that you want to use as a part of the URL slug.)
-
Generate the slug using the metafield value, you can use liquid code. Here’s an example for a product:
{% assign product_metafield = product.metafields.namespace.key %}
{% assign slug = product_metafield | handle %}
In this code:
product.metafields.namespace.key should be replaced with the actual namespace and key of your metafield.
handle is a filter in liquid that converts a string into a URL-friendly slug. It removes spaces, converts to lowercase, and replaces special characters.
Use the generated Slug in Your URLs
Example
custom product URL
{{ product.title }}
If you still need help from our side you can contact us through given details at signature
2 Likes