Upgrading module layouts to dynamic Studio sections
Dynamic sections are essentially module layouts, given a little bit of extra metadata so that Studio can read them and use them in the page. This article explains how to add that metadata to an existing module layout.
Written By Matt Jones
Last updated About 14 hours ago
Pre-requisites
To upgrade a module layout to a Studio dynamic section, you will need to be familiar with the Quickstart: CLI and have a connection to the site you’re building your library on CLI Site Setup . Siteglide Admin doesn’t yet support adding metadata in code-editor.
This article assumes you already have a module layout you’d like to upgrade, see Modules Reference
Do I lose anything when I upgrade a module layout to a dynamic section?
No, this is an upgrade, not a replacement. Dynamic sections will still work as ordinary module layouts, when you use the {% include 'module' %} or similar tags. Existing pages which already include the section will keep working.
This means it’s still absolutely fine to use an {% include %} tag within a static section to pull in a nested module layout.
Using as a dynamic section simply gives a different user-experience to the client. You can fine-tune which settings the client is given.
If you’re creating a library to share with others, upgrading allows the module layouts which reference that section to be installed along with the static sections when others download your library.
Metadata Reference
For each module layout, there will normally be more than one file which is needed to make that layout work. Normally these will at least all be inside the same folder, but not always.
For each layout, choose one file which will be the “top file” and will be used by Studio to read its metadata and find other dependencies. This should be the file that is first loaded when your module layout is used. Normally, the file will be named wrapper.liquid.
The top file must be given the following metadata in YML format in the frontmatter:
e.g.
---
metadata:
studio_library: my-library
---Full metadata example
In this example, the file views/partials/layouts/modules/module_14/product/live-updating-product-list/list/wrapper.liquid is the “top file” which will be given the metadata.
---
metadata:
settings:
- id: price_options_floor
type: number
label: Price Options Floor (Cents)
default: 500
- id: price_options_increment
type: number
label: Price Options Increment (Cents)
default: 500
- id: price_options_number
type: number
label: Price Options Number
default: 5
- id: show_display_price_crossed_out
type: boolean
label: Show Display Price Crossed Out
default: true
- id: product_category_parent
type: text
label: Product Category Parent
default:
- id: filters_values_from_URL
type: boolean
label: Set Filter Defaults From URL
default: false
- id: cart_url
type: text
label: Cart URL
default: "/cart"
studio_theme: studiokit
studio_library: studiokit
studio_dynamic/type: list
studio_dynamic/files:
- views/partials/layouts/modules/module_14/product/live-updating-product-list/list/wrapper.liquid
- views/partials/layouts/modules/module_14/product/live-updating-product-list/list/item.liquid
- views/partials/layouts/modules/module_14/components/add_to_cart_button/live-updating-product-list.liquid
studio_dynamic/theme: studiokit
studio_dynamic/layout: live-updating-product-list
studio_dynamic/theme_id: theme_01
studio_dynamic/module_id: module_14
studio_dynamic/layout_name: Live-updating product list
studio_dynamic/live_updates: 'true'
studio_dynamic/ui_framework: tailwind
studio_dynamic/original_name: Live Updating Product List
studio_dynamic/sub_module_id: '1'
studio_dynamic/make_global_form: false
---Module and submodule reference
Use this to determine which studio_dynamic/module_id and studio_dynamic/sub_module_id to give your layout in the metadata.