Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi everybody,
Perhaps a silly question (new to Shopify). I wonder if there's a way to create a set of metafields available in every page (ideally also blog post, product, collection page, etc...)
So if currently when you open a page (in edit view) you can see: Title, Content, SEO fields (title, desc, url handler), and an option to select a template.
And when you create metafields they seem to be attached to/available on THIS PAGE only.
I would like to have metafields that are attached to a template. So if ANY page selects a template it comes with a set of ready to use metafields.
The benefit is obvious - you can use the same template for many pages while keeping content and code separately.
Also you can create sitewide content blocks that can be included on various pages.
to be clear: "pages" - any store page that a user can access in browser (regardless of a page type "product, collection, page, blog, or whatever").
Is it possible? Please clarify 🙂
Solved! Go to the solution
This is an accepted solution.
@d4m wrote:way to create a set of metafields available in every page (ideally also blog post, product, collection page, etc...)
Yes put it on the shop object
If it needs to be some global contrivance put it on the shop {{ shop.metafields.custom.key }}, if it's a resource you can make some named /page in the admin that's no more than a glorified data holder i.e. /pages/extrastuff then reference that {{ pages.extrastuff.metafields.custom.key }}
And when you create metafields they seem to be attached to/available on THIS PAGE only.
Yes the values of the metafield are per resource
I would like to have metafields that are attached to a template. So if ANY page selects a template it comes with a set of ready to use metafields.
Metafields go to resources not theme assets.
If you need metafields, or other data, consistently part of a template just put them in the template.
The benefit is obvious - you can use the same template for many pages while keeping content and code separately.
But you haven't really as you still must reference any "global" metafields in code which is little more than storing static strings indirectly.
Also you can create sitewide content blocks that can be included on various pages.
You can already do this with page.content or theme snippets
https://shopify.dev/api/liquid/objects#pages
🙂
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This would be extremely helpful.
This is an accepted solution.
@d4m wrote:way to create a set of metafields available in every page (ideally also blog post, product, collection page, etc...)
Yes put it on the shop object
If it needs to be some global contrivance put it on the shop {{ shop.metafields.custom.key }}, if it's a resource you can make some named /page in the admin that's no more than a glorified data holder i.e. /pages/extrastuff then reference that {{ pages.extrastuff.metafields.custom.key }}
And when you create metafields they seem to be attached to/available on THIS PAGE only.
Yes the values of the metafield are per resource
I would like to have metafields that are attached to a template. So if ANY page selects a template it comes with a set of ready to use metafields.
Metafields go to resources not theme assets.
If you need metafields, or other data, consistently part of a template just put them in the template.
The benefit is obvious - you can use the same template for many pages while keeping content and code separately.
But you haven't really as you still must reference any "global" metafields in code which is little more than storing static strings indirectly.
Also you can create sitewide content blocks that can be included on various pages.
You can already do this with page.content or theme snippets
https://shopify.dev/api/liquid/objects#pages
🙂
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Thank you, @PaulNewton . This is clear!
I have figured out myself too... this was a question of a total newbie who came from another cms world. In my favorite MODX templates are a different kind of enemy than in Shopify. But, well, you just accept it and move on 🙂
apologies for picking up an old thread, but i'm trying to create a metafield against the shop object. I can't for the life of me figure out how to do that, either through rest API or via the shopify admin console. Any advice how to create a metafield against the shop ? Many thanks!
Same, have you figured it out?
Start here https://shopify.dev/docs/apps/custom-data/metafields
Direct example of creating a shop metafield:
Otherwise use a metafields app.
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025