Write product and collection files with templates
Outcome: products and collections you choose each have their own file, such as
products/trail-runner-2.md, carrying facts you wrote once in a template.
These per-item files are called family files. Product and collection files explains what’s in them. This guide is about making them.
Before you start
Section titled “Before you start”- The ShopMD app is installed. See Install the Shopify app.
- Decide what you want agents to know per item. Good candidates are facts a product page often leaves out: care instructions, fit, origin, warranty, who a collection is for.
Create a template
Section titled “Create a template”-
Open Templates. In the app’s navigation, open Templates and press New template.
-
Name it and pick what it applies to. The name is “For you. It never appears in a published file.” Choose Products (one file per product) or Collections (one file per collection). You can’t change this after the template is created.
-
Choose a starting group (products only). Start with a group (optional) takes a collection or product type from your store. Press Create template.
-
Choose what it covers. On the template’s page:
- Covers shows how many products or collections it reaches.
- Tick individual items in the list. Search by name, handle, type or tag.
- For product templates, Groups adds a whole collection, a product type, or All products. A group keeps matching, so a product added to it later is covered with no work.
- Never these excludes products by handle, even when a group includes them.
- Collections are picked by hand, not matched by a rule.
-
Add fields. Press Add a field and fill in:
- Label: “What an agent reads, such as Origin or Care.”
- Section: “The heading it lands under in each file.”
- Value: “The exact words written into each file.”
The Fields card counts them, for example “2 of 3 filled”. Empty fields are left out of every file.
-
Check the preview. The Preview card shows the file for one covered item, with “These are the exact bytes an agent receives.” Copy URL copies that file’s address.
-
Write the files. Go back to Templates and press Write the files. The toast says, for example, “Writing products files”. It writes one file per covered product or collection.
Give one item different values
Section titled “Give one item different values”Most items share the template’s wording. For the exception, use Give one product different values (or Give one collection different values) on the template’s page:
- Pick the item under Which product or Which collection.
- Press Make it different on a field and type the value for that item only. The toast says “Saved for this item”.
- To go back, clear the value: “Leave it empty to go back to the shared value.”
What you’ll see
Section titled “What you’ll see”A file built from a template with a “Care” section looks like this:
# Trail Runner 2
> Source: products/trail-runner-2.md
## Care
- **Machine wash**: Cold, gentle cycle. Air dry.It’s served at https://your-store.com/apps/shopmd/products/trail-runner-2.md. Each run writes the files
directly; they don’t wait for approval.
A product covered by two templates gets the fields of both. If both fill the same label, one template wins and the app shows which.
Keep them current
Section titled “Keep them current”Family files don’t rewrite themselves when you edit a template or your catalogue changes. After you change fields, coverage or products, press Write the files again. Coverage is worked out from your store each run, so new products in a covered group are picked up then.
A single run covers up to 1,000 products. If your store has more, the template page says “Your store has more than 1000 products. This counts the first 1000.”
Take files down
Section titled “Take files down”- Empty the last filled field of a template, and every file that no other template fills is taken off your domain. Fill a field again and they come back.
- Delete template stops its fields being written, and “any file nothing else covers is taken off your domain.” Values you set for single items go with it. This can’t be undone.
A file that’s taken down answers “not found”, like any address with no file.
If something goes wrong
Section titled “If something goes wrong”| What you see | What to do |
|---|---|
| Write the files is greyed out with “Fill a field on a template first.” | No template has a filled field yet. Add a value to a field. |
| “A run is already going. Its files appear as it finishes each batch.” | Wait for the current run. Its files appear as it goes. |
| “We could not read your catalogue, so we cannot say how many … this covers yet.” | ShopMD couldn’t reach your product data just now. Press Try again or reload later. |
| “Coverage is unknown right now” | Same cause. Your templates are saved; coverage shows once your catalogue can be read. |
| “This template covers nothing yet, so there is no file to show.” | Add a group, or tick an item. |