# Claim symbols and footnotes in the shared store: proposal

jbackus 20261119 - proposal only, nothing in the store or theme was changed

- Store: nutramax-staging.myshopify.com, live theme "Nutramax Theme" (id 161886077059, last edited Nov 17 2026 10:15 AM ET)
- Data: read-only pull on Nov 19 2026, 1:21 to 1:24 PM ET, through the shopify.nutramax.com admin app. It covered 433 theme text files, 281 products (239 active) with their metafields, 38 pages, 28 blog articles, 39 collections and every metaobject
- Companion file: `claims-footnotes-migration-20261119.csv` in this folder. It has 726 rows, one per content change the migration needs, with storefront and admin links

---

## 1. Summary

1. **One registry of footnotes.** Add a `claim_footnote` metaobject with one entry per footnote: its symbol(s), the approved text, its division and its legacy symbols. To start there are three entries: `▲` (Cosamin and Avmacol together), `*` (FDA, Consumer Care) and `◆, **` (Vet survey). Legal wording lives in one place, and changing an entry updates every page.
2. **The theme adds footnotes for you.** The layout already renders every page body through `content_for_layout`. We capture that HTML, ignore ingredient and directions panels, scripts and styles, and check which registered symbols appear. Then we render only those footnotes, once each, at the end of the main content. The footer is checked separately, so the marquee claim gets its own footnote in the footer. Any new page, product or section that makes a claim gets its footnote with no extra step.
3. **`**` is checked before `*`, and `*` only counts on Consumer Care pages.** After migration, Vet company claims use `**` and a single `*` means FDA only. The FDA footnote renders only where the page is Consumer Care or shows a Consumer Care product. Stray asterisks such as "5* Eventer" or "YES*" therefore never add an FDA footnote.
4. **A small script handles content that loads later.** `claim-footnotes.js` links each marker to its footnote with `<sup><a aria-describedby>`. It also covers content that appears after page load: quick-add, the where-to-buy dialog, the cart drawer and theme-editor reloads. A combined-listing variant switch reloads all of `<main>`, so the server-rendered footnotes are refreshed automatically.
5. **Rollout comes in stages and is reversible.** Build on an unpublished copy of the theme with "legacy mode" on, so today's `*`, `▼`, `★`, `△` and `♦` keep working. Then migrate content one brand at a time with before and after backups, and publish. Turn legacy mode off once the QA report is clean.

---

## 2. Current state

### 2.1 Where symbols are used

The scan separates **claim text** from **ingredient and directions panels** (`[[ingredients]]…[[/ingredients]]` and `[[directions]]…[[/directions]]` in product descriptions). A product description holds both, and the panels reuse the same symbols for unrelated notes.

| Symbol | Claim text: markers / footnote lines | Ingredient and directions panels: markers / footnote lines | Used today for |
|---|---|---|---|
| `*` | 340 / 21 | 41 / 35 | Vet company claim (209), Vet brand claim (29), Consumer Care structure/function claims tied to FDA (90), other (12) |
| `**` | 0 / 0 | 15 / 16 | Only supplement-facts notes, e.g. "**Percent Daily Values…", "**Reported as Glucosamine Hydrochloride" |
| `▲` | 11 / 6 | 78 / 52 | Claims: Cosamin and Avmacol brand claims only. Panels: Vet notes such as "▲Contains up to 10% moisture" (130 uses on 54 Vet products) |
| `◆` | 36 / 19 | 2 / 2 | Dasuquin brand claim ("Among veterinary brands…") |
| `▼` | 86 / 19 | 39 / 8 | Cosequin brand claim ("Among retail brands…"), also some Dasuquin products and articles |
| `★` | 21 / 14 | 0 | Denamarin brand claim (liver support survey) |
| `△` | 8 / 2 | 0 | Welactin brand claim; Dasuquin ratings claim on the brand page |
| `♦` | 3 / 0 | 2 / 2 | Dasuquin brand and about pages, with no footnote on those pages |
| `†` `‡` `●` `▴` `◇` `✝` `§` `⌃` | about 4 | 130+ | Ingredient, analysis and dosing notes only. **These are out of scope and must not be touched** |

The theme's `snippets/text-escape.liquid` already superscripts `★ ♦ △ ▼` (and `® ™ ©`) in every text block. It does not handle `▲`, `◆` or `*`.

### 2.2 The `*` conflict

- `templates/product.json` puts three Vet company claims on **every** product page, Consumer Care included: "…proud to be the #1 veterinarian recommended supplement company.*", "#1 Veterinarian Recommended*" and "Nutramax is the #1 Veterinarian Recommended Supplement Company.*"
- The footer marquee on every page says "The #1 Veterinarian Recommended Supplement Company*". The footer legal text says "* Source: Survey conducted among veterinarians who recommend animal supplements."
- On the 18 active Cosamin and Avmacol product pages, a single `*` therefore points at two footnotes: the FDA statement in the description and the Vet survey in the footer. The same happens on the Cosamin and Avmacol brand, about and FAQ pages and `/pages/species/human`, because the marquee and footer show there too.
- The where-to-buy dialog shows the "Number 1 Veterinarian Recommended" badge image for every product with retailers, Cosamin and Avmacol included. It has no marker and no footnote.

### 2.3 Gaps and inconsistencies

- **Vet company claims without a footnote in the same content.** 60 active products, 10 archived and 4 drafts have one, plus 12 theme templates: `index.json`, `product.json`, `page.dasuquin-about.json`, `metaobject/brand.json`, `metaobject/species.json`, and the brand templates for Cobalequin, Denosyl, Filaquin, Mycequin, Naraquin, Proviable and Solliquin. Today only the site-wide footer covers them.
- **Vet brand claims without a footnote in the same content.** 34 active products, 6 theme templates and 3 brand metaobject descriptions (Cosequin, Denamarin, Welactin).
- **`▲` claims without the `▲` footnote.** 5 active Cosamin products, including `cosamin-ds` and `cosm-ds_no-crtn-hum-tab-150ct`, plus 1 unlisted Avmacol product.
- **Nine versions of the Vet survey footnote are in use.** "small animal veterinarians", "recommended" or "recommend", "omega-3 supplements", "liver support supplements", "Among veterinary brands… oral joint health", "Among retail brands…". One article repeats text by mistake: `news/cosequin®-celebrates-akc-diving-dogs-premier-cup-…` reads "…supplements.inarians who recommended animal supplements."
- **Two Cosamin footnotes add a sentence.** The Cosamin brand page and the Cosamin about page add "Human supplements are sold by Nutramax Laboratories Consumer Care, Inc." to the `▲` text.
- **Claims with no marker at all.** 251 of the 496 "#1" claims in `nutramax-number-one-claims-20261119.csv` have none, and 169 of those are in the `custom.short_description` metafield shown under the product title.
- **Division data is incomplete.** 101 products have no `custom.brand`. One Avmacol product has vendor "Veterinary Sciences", and 12 products have vendor "Nutramax Staging".

---

## 3. Recommended architecture

### 3.1 Footnote registry (metaobject `claim_footnote`)

| Field | Type | Example (vs-survey) | Notes |
|---|---|---|---|
| handle | system | `vs-survey` | Stable key used in ids, e.g. `claim-fn-main-vs-survey` |
| `symbols` | list.single_line_text_field | `◆`, `**` | Markers that trigger the footnote. Add `&#42;&#42;` too if anyone enters the entity (see 5.1) |
| `legacy_symbols` | list.single_line_text_field | `▼`, `★`, `△`, `♦`, `*` | Recognized only while legacy mode is on. A legacy `*` counts only on Vet pages |
| `label` | single_line_text_field (optional) | *(blank)* | Blank means "list the symbols found on this page", e.g. `◆, **`, or just `**` where only the company claim appears |
| `text` | rich_text_field | Source: Survey conducted among veterinarians who recommend animal supplements. | Legal wording, translatable |
| `division` | single_line_text_field, choices `any`, `cc`, `vs` | `any` | `cc` entries render only on Consumer Care pages or pages showing a Consumer Care product |
| `brands` | list.metaobject_reference → brand | Dasuquin, Cosequin… | Reference for QA and for legal review |

Starting entries:

| handle | symbols | division | text |
|---|---|---|---|
| `cc-brand` | `▲` | cc | Based on U.S. studies published in peer-reviewed journals, the Cosamin® brand is the most researched glucosamine/chondroitin sulfate brand. The Avmacol® brand has been selected for use in more sulforaphane human clinical trials than any other sulforaphane-producing supplement in the marketplace. |
| `vs-survey` | `◆`, `**` | any | Source: Survey conducted among veterinarians who recommend animal supplements. |
| `cc-fda` | `*` | cc | THESE STATEMENTS HAVE NOT BEEN EVALUATED BY THE FOOD AND DRUG ADMINISTRATION. THIS PRODUCT IS NOT INTENDED TO DIAGNOSE, TREAT, CURE, OR PREVENT ANY DISEASE. |

`vs-survey` uses division `any` on purpose. `◆` and `**` are used only by Vet claims in claim text; the `**` in supplement facts sits in the excluded panels. So a Vet claim shown on a Consumer Care page, such as the product template sections, still gets its footnote.

The display order is the order of the theme setting **Claim footnotes** (a `metaobject_list` setting). That lets the order change without code. Proposed order: `▲`, then `**`/`◆`, then `*` (FDA last, as in Jeremy's example).

The brand metaobject gets a new `division` field: `cc` for Cosamin and Avmacol, `vs` for the other 17 brands. Pages, articles and collections get an optional `custom.claims_division` metafield as an override.

Sample definition (Admin GraphQL; to run in phase 1 after approval):

```graphql
mutation {
  metaobjectDefinitionCreate(definition: {
    type: "claim_footnote"
    name: "Claim footnote"
    access: { storefront: PUBLIC_READ }
    capabilities: { publishable: { enabled: true }, translatable: { enabled: true } }
    fieldDefinitions: [
      { key: "symbols", name: "Symbols", type: "list.single_line_text_field", required: true }
      { key: "legacy_symbols", name: "Legacy symbols", type: "list.single_line_text_field" }
      { key: "label", name: "Label (blank = symbols found)", type: "single_line_text_field" }
      { key: "text", name: "Footnote text", type: "rich_text_field", required: true }
      { key: "division", name: "Division", type: "single_line_text_field",
        validations: [{ name: "choices", value: "[\"any\",\"cc\",\"vs\"]" }] }
      { key: "brands", name: "Brands", type: "list.metaobject_reference" }
    ]
  }) { metaobjectDefinition { id } userErrors { field message } }
}
```

### 3.2 Page division (`snippets/claims-context.liquid`)

| Page | Division |
|---|---|
| Product | `product.metafields.custom.brand.value.division`, else vendor ("Consumer Care" means cc, "Veterinary Sciences" means vs) |
| `/pages/brand/<handle>` | that brand's `division` |
| `/pages/species/human` | cc. Other species are vs |
| Vet blog (`vet-learning-center`), vet layout pages | vs |
| Everything else (home, collections, search, cart, news, policies) | shared, unless `custom.claims_division` is set |

On a shared page, the FDA footnote renders only when the HTML contains `data-claims-division="cc"`. Product cards and featured-product blocks add that attribute for Consumer Care products, which is a one-line change in `snippets/product-card.liquid`.

```liquid
{%- doc -%}
  Echoes the claims division for the current page: cc, vs or shared.
  Order: explicit page/article/collection metafield, brand division,
  product vendor, URL of brand/species metaobject pages, vet blog, else shared.

  @example
  {% capture claims_division %}{% render 'claims-context' %}{% endcapture %}
{%- enddoc -%}
{%- liquid
  assign claims_division = ''
  case request.page_type
    when 'product'
      assign claims_division = product.metafields.custom.brand.value.division.value
      if claims_division == blank
        case product.vendor
          when 'Consumer Care'
            assign claims_division = 'cc'
          when 'Veterinary Sciences'
            assign claims_division = 'vs'
        endcase
      endif
    when 'page'
      assign claims_division = page.metafields.custom.claims_division.value
    when 'article'
      assign claims_division = article.metafields.custom.claims_division.value
      if claims_division == blank and blog.handle contains 'vet'
        assign claims_division = 'vs'
      endif
    when 'blog'
      if blog.handle contains 'vet'
        assign claims_division = 'vs'
      endif
    when 'collection'
      assign claims_division = collection.metafields.custom.claims_division.value
    when 'metaobject'
      assign path_parts = request.path | split: '/'
      assign mo_handle = path_parts | last
      if request.path contains '/pages/brand/'
        assign claims_division = metaobjects.brand[mo_handle].division.value
      elsif request.path contains '/pages/species/'
        if mo_handle == 'human' or mo_handle == 'humans'
          assign claims_division = 'cc'
        else
          assign claims_division = 'vs'
        endif
      endif
  endcase
  echo claims_division | default: 'shared' | strip
-%}
```

### 3.3 Server-side detection and rendering (`snippets/claim-footnotes.liquid`)

How it works:

1. Drops anything between `<!--claim-fn-ignore-->` and `<!--/claim-fn-ignore-->`. That covers footnote lists already rendered, and any region an editor wants excluded.
2. Runs `strip_html`, which removes tags and attributes along with the content of `<script>`, `<style>` and HTML comments. Alt text and JSON never count as markers.
3. Removes the `[[ingredients]]` and `[[directions]]` ranges, which is where the 130 Vet `▲`, the supplement-facts `**` and all the `†` `‡` live.
4. Checks `**` first, then removes it before checking for a single `*`.
5. Skips a footnote that a section slot already rendered (`data-claim-fn="…"`), so it doesn't repeat.
6. Supports explicit references for images and badges: `data-claim-ref="vs-survey"` on the element.

```liquid
{%- doc -%}
  Renders the claim footnotes needed by a piece of rendered HTML.
  Footnotes come from the claim_footnote metaobjects listed in the theme
  setting "Claim footnotes" (settings.claim_footnotes), in that order.

  @param {string} html - Rendered HTML to scan, e.g. captured content_for_layout
  @param {string} division - Page context: cc, vs or shared
  @param {string} scope - main, footer or section; used in ids and classes
  @param {boolean} [legacy] - Also detect legacy_symbols (during content migration)

  @example
  {% render 'claim-footnotes', html: main_html, division: claims_division, scope: 'main' %}
{%- enddoc -%}
{%- liquid
  assign registry = settings.claim_footnotes

  assign kept = ''
  assign chunks = html | split: '<!--claim-fn-ignore-->'
  for chunk in chunks
    if forloop.first
      assign kept = kept | append: chunk
    else
      assign tail = chunk | split: '<!--/claim-fn-ignore-->'
      if tail.size > 1
        assign kept = kept | append: tail.last
      endif
    endif
  endfor

  assign page_has_cc = false
  if division == 'cc'
    assign page_has_cc = true
  elsif kept contains 'data-claims-division="cc"'
    assign page_has_cc = true
  endif
  assign page_has_vs = false
  if division == 'vs'
    assign page_has_vs = true
  elsif division == 'shared'
    assign page_has_vs = true
  endif

  assign text = kept | strip_html
  assign zone_keys = 'ingredients,directions' | split: ','
  for zone_key in zone_keys
    assign zone_open = '[[' | append: zone_key | append: ']]'
    assign zone_close = '[[/' | append: zone_key | append: ']]'
    if text contains zone_open
      assign zone_parts = text | split: zone_open
      assign rebuilt = ''
      for zone_part in zone_parts
        if forloop.first
          assign rebuilt = rebuilt | append: zone_part
        else
          assign zone_tail = zone_part | split: zone_close
          if zone_tail.size > 1
            assign rebuilt = rebuilt | append: zone_tail.last
          endif
        endif
      endfor
      assign text = rebuilt
    endif
  endfor
  assign text_single = text | remove: '**'

  capture items
    for fn in registry
      assign fn_key = fn.system.handle
      assign fn_division = fn.division.value | default: 'any'
      if fn_division == 'cc' and page_has_cc == false
        continue
      endif
      if fn_division == 'vs' and page_has_vs == false
        continue
      endif

      assign rendered_marker = 'data-claim-fn="' | append: fn_key | append: '"'
      if scope != 'section' and html contains rendered_marker
        continue
      endif

      assign found = ''
      assign symbol_lists = fn.symbols.value
      for symbol in symbol_lists
        if symbol == '*'
          if text_single contains '*'
            assign found = found | append: symbol | append: '|'
          endif
        elsif text contains symbol
          assign found = found | append: symbol | append: '|'
        endif
      endfor
      if legacy and fn.legacy_symbols.value != blank
        for symbol in fn.legacy_symbols.value
          if symbol == '*' and division != 'vs'
            continue
          endif
          if text contains symbol
            assign found = found | append: symbol | append: '|'
          endif
        endfor
      endif

      assign explicit_ref = 'data-claim-ref="' | append: fn_key | append: '"'
      if found == blank and kept contains explicit_ref
        assign found = fn.symbols.value | join: '|'
      endif
      if found == blank
        continue
      endif

      assign found_symbols = found | split: '|' | uniq
      assign fn_label = fn.label.value
      if fn_label == blank
        assign fn_label = found_symbols | join: ', '
      endif
      assign fn_id = 'claim-fn-' | append: scope | append: '-' | append: fn_key
      assign found_attr = found | escape
      echo '<li class="claim-footnotes__item" id="' | append: fn_id | append: '" data-claim-fn="' | append: fn_key | append: '" data-claim-symbols="' | append: found_attr | append: '">'
      echo '<span class="claim-footnotes__symbol">' | append: fn_label | append: '</span> '
      echo fn.text | metafield_tag
      echo '</li>'
    endfor
  endcapture
-%}
{%- if items != blank -%}
  <!--claim-fn-ignore-->
  <aside class="claim-footnotes claim-footnotes--{{ scope }}" aria-label="Footnotes" data-claim-footnotes="{{ scope }}">
    <ul class="claim-footnotes__list" role="list">
      {{- items -}}
    </ul>
  </aside>
  <!--/claim-fn-ignore-->
{%- endif -%}
{% stylesheet %}
  .claim-footnotes {
    font-size: 0.8125rem;
    line-height: 1.4;
    margin-block: 1.5rem;
    padding-inline: var(--page-margin, 1rem);
  }
  .claim-footnotes__list {
    list-style: none;
    margin: 0;
    padding: 0;
  }
  .claim-footnotes__item {
    display: flex;
    gap: 0.25em;
  }
  .claim-footnotes__item p {
    margin: 0;
    font-style: italic;
  }
  .claim-ref a {
    color: inherit;
    text-decoration: none;
  }
  .claim-ref a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 1px;
  }
{% endstylesheet %}
```

### 3.4 Layout change (both `layout/theme.liquid` and `layout/vet.liquid`)

The current code is at `theme.liquid` lines 103 to 114 and `vet.liquid` lines 176 to 187:

```liquid
<main id="MainContent" class="content-for-layout" role="main" data-template="{{ template }}">
  {{ content_for_layout }}
</main>
<footer>
  {% sections 'footer-group' %}
</footer>
```

Proposed:

```liquid
{%- capture claims_division -%}{% render 'claims-context' %}{%- endcapture -%}
{%- capture main_html -%}{{ content_for_layout }}{%- endcapture -%}
<main id="MainContent" class="content-for-layout" role="main" data-template="{{ template }}" data-claims-division="{{ claims_division }}">
  {{ main_html }}
  {% render 'claim-footnotes', html: main_html, division: claims_division, scope: 'main', legacy: settings.claim_footnotes_legacy %}
</main>
<footer>
  {%- capture footer_html -%}{% sections 'footer-group' %}{%- endcapture -%}
  {{ footer_html }}
  {% render 'claim-footnotes', html: footer_html, division: 'shared', scope: 'footer', legacy: settings.claim_footnotes_legacy %}
</footer>
{% render 'claim-footnotes-registry', division: claims_division %}
```

The footnote list is rendered **inside `<main>`**. `variant-picker.js` replaces all of `<main>` with the new product's server HTML when a shopper switches to another combined-listing product. The footnotes therefore always match the product on screen, with no JavaScript needed for that case.

Two new theme settings go in the "Claims" group of `config/settings_schema.json`:

```json
{ "type": "metaobject_list", "id": "claim_footnotes", "label": "Claim footnotes", "metaobject_type": "claim_footnote", "limit": 20 },
{ "type": "checkbox", "id": "claim_footnotes_legacy", "label": "Also detect legacy claim symbols", "default": true }
```

### 3.5 Footnotes near the claim (optional section slot, `blocks/claim-footnotes.liquid`)

By default footnotes render at the end of the main content, just above the footer. Any section that should show its footnotes right below its own content can take a **Claim footnotes** block. Good candidates are the product-information section under the buy box, brand heroes and the "quality" sections that hold typed footnotes today. The script fills the slot and hides the end-of-page copy if nothing else on the page refers to it. Without JavaScript, the end-of-page list is still there.

```liquid
{%- doc -%}
  Section-level footnote slot. Add it to any section that makes claims to
  show that section's footnotes right under its content. The layout list
  skips footnotes a slot already shows.
{%- enddoc -%}
<div class="claim-footnotes-slot" data-claim-footnotes-slot {{ block.shopify_attributes }}></div>
{% schema %}
{
  "name": "Claim footnotes",
  "settings": [],
  "presets": [{ "name": "Claim footnotes" }]
}
{% endschema %}
```

### 3.6 JavaScript (`assets/claim-footnotes.js` and the registry JSON)

What it does:

- Wraps each registered marker that directly follows text in `<sup class="claim-ref"><a href="#claim-fn-…" aria-describedby="claim-fn-…">`. If the symbol is already inside the `<sup>` from `text-escape`, it reuses that `<sup>`.
- Skips scripts, styles, links, ingredient panels (`product-customer-instructions`, `[data-shortcode-pending]`) and the footnote lists themselves.
- Applies division rules to each element using the nearest `data-claims-division`, so a Consumer Care product card on the home page gets the FDA link and a "YES*" on a policy page does not.
- Handles content added after page load, such as the quick-add modal, the where-to-buy dialog, the cart drawer and predictive search. A MutationObserver adds a small footnote list inside that dialog or section when the page's own list doesn't cover it.
- Re-runs on `ThemeEvents.variantUpdate`, the same hook `product-description.js` uses for combined listings, and on `shopify:section:load` in the theme editor.

```liquid
{%- doc -%}
  Outputs the footnote registry as JSON for assets/claim-footnotes.js,
  which links markers and covers content loaded after page render.

  @param {string} division - Page context: cc, vs or shared

  @example
  {% render 'claim-footnotes-registry', division: claims_division %}
{%- enddoc -%}
<script type="application/json" id="claim-footnote-registry" data-division="{{ division | escape }}">
  [
  {%- for fn in settings.claim_footnotes -%}
    {
      "key": {{ fn.system.handle | json }},
      "division": {{ fn.division.value | default: 'any' | json }},
      "symbols": {{ fn.symbols.value | json }},
      "legacy": {% if settings.claim_footnotes_legacy %}{{ fn.legacy_symbols.value | json }}{% else %}[]{% endif %},
      "label": {{ fn.label.value | json }},
      "html": {{ fn.text | metafield_tag | json }}
    }{%- unless forloop.last -%},{%- endunless -%}
  {%- endfor -%}
  ]
</script>
<script src="{{ 'claim-footnotes.js' | asset_url }}" type="module"></script>
```

```js
import { ThemeEvents } from '@theme/events';

const registryEl = document.getElementById('claim-footnote-registry');
const registry = registryEl ? JSON.parse(registryEl.textContent || '[]') : [];
const pageDivision = registryEl?.dataset.division || 'shared';
const SKIP = 'script, style, template, textarea, noscript, a, product-customer-instructions, [data-shortcode-pending], .claim-footnotes, [data-claim-fn-ignore]';

const applies = (fn, division) =>
  fn.division === 'any' || fn.division === division || (division === 'shared' && fn.division === 'vs');

function symbolMap(division) {
  const map = new Map();
  for (const fn of registry) {
    if (!applies(fn, division)) continue;
    for (const s of [...(fn.symbols || []), ...(fn.legacy || [])]) if (!map.has(s)) map.set(s, fn);
  }
  return map;
}

function markerRegex(map) {
  const parts = [...map.keys()]
    .sort((a, b) => b.length - a.length)
    .map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
  return parts.length ? new RegExp(`(?<=[^\\s*])(${parts.join('|')})`, 'gu') : null;
}

function divisionFor(node) {
  const own = node.closest?.('[data-claims-division]');
  return own?.dataset.claimsDivision || pageDivision;
}

export function markClaims(root = document.body) {
  const found = new Map();
  const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
    acceptNode: (n) => (n.parentElement && !n.parentElement.closest(SKIP) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT),
  });
  const nodes = [];
  for (let n = walker.nextNode(); n; n = walker.nextNode()) nodes.push(n);

  for (const node of nodes) {
    const map = symbolMap(divisionFor(node.parentElement));
    const re = markerRegex(map);
    if (!re || !re.test(node.data)) continue;
    re.lastIndex = 0;
    const frag = document.createDocumentFragment();
    let last = 0;
    for (const m of node.data.matchAll(re)) {
      const fn = map.get(m[1]);
      frag.append(node.data.slice(last, m.index));
      const scopeEl = scopeFor(node.parentElement);
      const target = `claim-fn-${scopeKey(scopeEl)}-${fn.key}`;
      const a = Object.assign(document.createElement('a'), { href: `#${target}`, textContent: m[1] });
      a.setAttribute('aria-describedby', target);
      const insideSup = node.parentElement.tagName === 'SUP';
      const sup = insideSup ? a : Object.assign(document.createElement('sup'), { className: 'claim-ref' });
      if (!insideSup) sup.append(a);
      frag.append(sup);
      last = m.index + m[1].length;
      if (!found.has(scopeEl)) found.set(scopeEl, new Map());
      found.get(scopeEl).set(fn.key, { fn, symbol: m[1], target });
    }
    frag.append(node.data.slice(last));
    if (node.parentElement.tagName === 'SUP') node.parentElement.classList.add('claim-ref');
    node.replaceWith(frag);
  }
  ensureFootnotes(found);
  hideUnreferenced();
}

function scopeFor(el) {
  const section = el.closest('.shopify-section');
  if (section?.querySelector('[data-claim-footnotes-slot]')) return section;
  return el.closest('dialog, main, footer') || document.body;
}

const scopeIds = new WeakMap();
let scopeSeq = 0;
function scopeKey(el) {
  if (el === document.body || el.tagName === 'MAIN') return 'main';
  if (el.tagName === 'FOOTER') return 'footer';
  if (!scopeIds.has(el)) scopeIds.set(el, el.id || `s${++scopeSeq}`);
  return scopeIds.get(el);
}

function ensureFootnotes(found) {
  for (const [scopeEl, fns] of found) {
    for (const { fn, symbol, target } of fns.values()) {
      if (document.getElementById(target)) continue;
      const slot = scopeEl.querySelector('[data-claim-footnotes-slot]');
      const existing = scopeEl.querySelector(`[data-claim-fn="${fn.key}"]`);
      if (existing && !slot) {
        existing.id ||= target;
        relinkTo(scopeEl, fn.key, existing.id);
        continue;
      }
      const host = slot || appendList(scopeEl);
      const li = document.createElement('li');
      li.className = 'claim-footnotes__item';
      li.id = target;
      li.dataset.claimFn = fn.key;
      li.innerHTML = `<span class="claim-footnotes__symbol">${fn.label || symbol}</span> ${fn.html}`;
      (host.querySelector('ul') || host).append(li);
    }
  }
}

function hideUnreferenced() {
  document.querySelectorAll('.claim-footnotes--main [data-claim-fn]').forEach((li) => {
    const used = document.querySelector(`.claim-ref a[href="#${li.id}"]`);
    li.hidden = !used && document.querySelector(`[data-claim-footnotes-slot] [data-claim-fn="${li.dataset.claimFn}"]`) !== null;
  });
}

function relinkTo(scopeEl, key, id) {
  scopeEl.querySelectorAll(`.claim-ref a[href^="#claim-fn-"][href$="-${key}"]`).forEach((a) => {
    a.href = `#${id}`;
    a.setAttribute('aria-describedby', id);
  });
}

function appendList(scopeEl) {
  const aside = document.createElement('aside');
  aside.className = 'claim-footnotes claim-footnotes--inline';
  aside.setAttribute('aria-label', 'Footnotes');
  aside.innerHTML = '<ul class="claim-footnotes__list" role="list"></ul>';
  (scopeEl.querySelector('.dialog-content, .section') || scopeEl).append(aside);
  return aside;
}

function init() {
  markClaims(document.body);
  new MutationObserver((records) => {
    for (const r of records) {
      for (const n of r.addedNodes) {
        if (n.nodeType === Node.ELEMENT_NODE && !n.closest('.claim-footnotes') && !n.querySelector?.('.claim-ref')) markClaims(n);
      }
    }
  }).observe(document.body, { childList: true, subtree: true });
}

document.addEventListener(ThemeEvents.variantUpdate, () => requestAnimationFrame(() => markClaims(document.querySelector('main') || document.body)));
document.addEventListener('shopify:section:load', (e) => markClaims(e.target));

if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init, { once: true });
else init();
```

### 3.7 Checks run on the samples

- **Shopify theme-check** (`@shopify/theme-check-node`, recommended checks): 0 problems on the snippets, block, layout and settings. A deliberately broken file was flagged, which confirms the checker was running.
- **JavaScript**: `node --check` passes.
- **Liquid logic** was tested with python-liquid, using a test registry, on hand-made cases and on the real description and short description of every active product:

| Case | Footnotes rendered |
|---|---|
| Cosamin product: `▲` claim, `*` structure/function, `**` only in supplement facts, `/**` in a script | ▲ (Cosamin + Avmacol), * FDA. **No** Vet footnote |
| Dasuquin product: `◆` claim, company `**`, Vet `▲` and `*` inside the ingredients panel | `◆, **` Vet survey only |
| Vet page with only a company claim | `**` Vet survey |
| Cosequin `▼` claim, legacy mode on | `▼` Vet survey |
| Article "International 5* Eventer" (Vet) | none |
| Privacy page "YES*" (shared) | none |
| Home page with a Consumer Care card (`*`) and a company `**` | `**` Vet survey and * FDA |
| Consumer Care page showing the product-template company claim as `**` | `**` Vet survey and * FDA |
| Footnote already rendered in a section slot | not repeated |
| Badge image with `data-claim-ref="vs-survey"` | `◆, **` Vet survey |

  On today's content with legacy mode on, all 221 active Vet products get the Vet footnote. All 18 active Consumer Care products get FDA, and the 5 with a `▲` claim also get the combined `▲` footnote.
- **Not verified yet.** python-liquid is close to Shopify Liquid but is not Shopify's engine. Three things must be checked on the unpublished copy of the theme: `strip_html` on real pages, `{% sections %}` inside `capture`, and `metaobject_list` settings. None of this has been tried on a Shopify theme yet.

---

## 4. Content and theme changes (migration)

The full row-by-row list with storefront and admin links is in `claims-footnotes-migration-20261119.csv`. Columns: division, brand, source, handle, field, status, combined listing role, kind, current symbol, proposed symbol, category, action, text, url, admin url.

| Change | Rows | Products / other content | Notes |
|---|---|---|---|
| Vet company claim `*` → `**` | 209 | 129 items: 114 products, 14 theme templates, 1 article | Includes the three `product.json` claims and the footer marquee |
| Vet brand claim symbols other than `◆` (`▼` 71, `*` 29, `★` 21, `△` 7, `♦` 3) | 131 | 86 items | Change to `◆` only if legal decides on one Vet brand symbol (question 1). Otherwise they stay as legacy symbols in the registry |
| Vet brand claims already `◆` | 36 | 19 products | No change |
| Remove typed Vet survey footnotes | 65 | 61 items | The automatic footnote replaces them |
| Remove typed `▲` footnotes (Cosamin, Avmacol) | 5 | 5 theme templates | Replaced by the single combined `▲` footnote |
| Typed FDA text in theme templates | 5 | 5 | Keep, or let the automatic FDA footnote replace them (question 5) |
| Claims with no marker | 251 | 169 short descriptions, 28 description lines, 41 lines in `content/Bullets` source files, 13 theme items | Add `**`, `◆` or `▲` as listed, or confirm none is needed |
| Single `*` in Vet or shared content that isn't a company claim | 8 | e.g. "5* Eventer", "YES*", "Yeast Extract*" | Review. Some are not claims |
| Fix repeated text | 1 | article `news/cosequin®-celebrates-akc-diving-dogs-…` | |
| Footer | 2 | `sections/footer-group.json` | Marquee `Company*` → `Company**`. Remove "* Source: …" from the legal text block; the footer list renders it automatically |

Migration method: an Admin API script on WW7 run as nmxcode, reusing today's read-only token helper.

- It does a dry run first that writes a before-and-after CSV into this folder. Changes happen only after Jeremy approves that CSV.
- It changes one brand at a time.
- It saves each product's original `descriptionHtml` and metafields to `/root/backups/claims-footnotes-YYYYMMDD/` before writing.
- It changes only claim text, never the `[[ingredients]]` or `[[directions]]` ranges.
- It can be run again safely: `**` is never changed to `***`.
- Theme template edits go into the unpublished copy, never the live theme.

---

## 5. Edge cases

### 5.1 `**` in rich text and Markdown: options compared

- **Inside Shopify** (the product description editor, theme `richtext` and `inline_richtext` settings, page and article editors, rich text metafields), content is stored as HTML. `**` is plain text, not bold; the store already shows "**Percent Daily Values…" as written. The shopify.nutramax.com content pipeline (`content/Bullets`, `Ingredients` and the uploader) has no Markdown library, so files pass through unchanged.
- **The risk is upstream and in copy-paste.** Copy written in Markdown-aware tools (AI chat tools, Notion, GitHub, Slack and Teams) turns `**text**` into bold, or drops the asterisks on paste. A pair like `Company** … brand**` can bold the text in between and lose both markers.

| Option | How it's entered | Pros | Cons | Recommendation |
|---|---|---|---|---|
| A. Literal `**` and `◆` | type the symbol | What legal approves is exactly what shows. Feeds, Amazon CSV and Google get the same text | Markdown tools upstream can eat it | **Recommended** |
| B. HTML entity `&#42;&#42;` | HTML view only | Survives Markdown processors | `strip_html` doesn't decode entities, so add `&#42;&#42;` to `symbols` | Accept where needed |
| C. Token `[[vs-company]]` → `**` (resolved in `text-escape`) | type the token | Clear meaning, survives Markdown | Product descriptions go raw to other sales channels, so the token would show there. The theme's `[[…]]` parser would also have to ignore it | Theme settings only, if at all |
| D. `<sup data-claim-ref="vs-survey">**</sup>` | HTML view | Clearest meaning, can mark a claim without a symbol | Too technical for routine editing | For special cases and image badges |

We also suggest extending `text-escape.liquid` to superscript `▲` and `◆` the same way it already does `★ ♦ △ ▼`. The script superscripts `**` and `*` when it links them.

### 5.2 Other cases

- **Ingredient panels.** Vet `▲`, the facts `**`, and all of `† ‡ ● ▴ ◇ ✝ § ⌃` are excluded by the panel ranges. A product whose facts aren't wrapped in `[[ingredients]]` would be checked, but today no claim text anywhere contains `**`. The QA report (section 7) will flag any that show up.
- **Same symbol, different meanings.** `▲` is a Consumer Care claim symbol and also a Vet ingredient note. The registry marks `▲` as `cc` and the panels are excluded, so a Vet product never gets the Cosamin and Avmacol footnote.
- **Duplicates during the transition.** Until typed footnotes are removed, a page can show the typed one and the automatic one. The automatic footnote is skipped only when the identical text is already present, which is rare because the wording changes. This is why the content migration comes before turning legacy mode off.
- **Combined listings.** All of `<main>` is replaced on a product switch, so server footnotes are fresh and the script adds the links again on `variantUpdate`.
- **Theme editor.** Section reloads don't re-render the layout. The script adds any missing footnotes on `shopify:section:load`, and a full reload is exact.
- **Images, SVG badges and logos** (the where-to-buy "Number 1 Veterinarian Recommended" badge, accolade logos) can't carry a symbol. Use `data-claim-ref` or a caption, or hide them on Consumer Care pages (question 4).
- **Sales channels and feeds** (Google, Shop app, Amazon CSV) get raw `descriptionHtml` without theme footnotes. Removing typed footnotes from descriptions would also remove them from feeds (question 8). If feeds must keep them, leave them in the description inside `<p class="claim-fn-source">`, hide that class on the storefront, and let the automatic footnote show.
- **Translations and markets.** Footnote text is a translatable metaobject field (Translate & Adapt).
- **Email, checkout and the Shop app** aren't covered by the theme and are out of scope.

---

## 6. Accessibility, SEO, performance

- **Accessibility.**
  - Each marker is a link with `aria-describedby`, so screen readers read the footnote text after the claim, and keyboard users can tab to it. It has a visible focus ring and inherits its color, so it isn't styled as a regular link.
  - Footnotes sit in `<aside aria-label="Footnotes">` as a list. Text is 13px italic in the same color scheme; check contrast is at least 4.5:1.
  - Screen readers read symbols as "black diamond", "star star" and so on. Optionally add visually hidden text such as "see footnote".
- **SEO.**
  - Footnotes are rendered on the server, so search engines see them, and the repeated text is normal boilerplate with no penalty.
  - Product JSON-LD keeps the raw symbols, which is harmless.
  - Keep symbols out of SEO titles and meta descriptions; today no claims are there.
- **Performance.**
  - The server side is a handful of `split` and `contains` calls on HTML already in memory, about 100 to 500 KB per page, checked against at most a few registry entries. That is negligible next to section rendering; confirm with Shopify Theme Inspector on the copy.
  - The script makes one TreeWalker pass over the page on load and on product switches. The observer only looks at newly added nodes. There are no network calls: the registry is inline JSON of about 1 KB.

---

## 7. Workflow for new content

1. Write the claim and type its symbol right after it, with no space:

   | Claim | Symbol |
   |---|---|
   | Vet company claim | `**` |
   | Vet brand claim | `◆` (or the brand's legacy symbol, pending question 1) |
   | Cosamin or Avmacol brand claim | `▲` |
   | Consumer Care structure/function claim | `*` |

2. **Don't type the footnote text.** The theme adds it once per page, plus once in the footer if the footer makes the claim.
3. Image or badge claims: add `data-claim-ref="<handle>"` (developer task) or a caption with the symbol.
4. A new kind of claim or source: create a `claim_footnote` entry (legal-approved text), then add it to the theme setting "Claim footnotes" in the right order.
5. A weekly read-only QA scan, the same scan used today run on WW7, writes a CSV to this folder. It flags:
   - claims with no marker
   - symbols not in the registry
   - a single `*` in Vet content
   - typed footnote text still in content
   - `**` outside the panels on Consumer Care products
   - products with no brand or division

   It can be set up as a recurring job if wanted.

---

## 8. Phased rollout (each phase needs Jeremy's OK; theme and content writes use the admin app's write_themes and product scopes)

| Phase | Work | Visible to shoppers? | Backup / rollback |
|---|---|---|---|
| 0. Decisions | Answers to section 9 | No | |
| 1. Build | Duplicate Nutramax Theme into an unpublished "Nutramax Theme - footnotes". Create the `claim_footnote` definition and 3 entries, add the brand `division` field and values, and add the snippets, block, JS, settings and both layout changes. Legacy mode on | No (the copy is unpublished; metaobjects are unused until the theme is published) | Today's full theme pull is in `/home/nmxcode/footnotes-20261119/dump/`, and a fresh one is taken right before. The copy itself is the rollback |
| 2. QA on preview | Test plan below, desktop and mobile, with and without JavaScript | No | |
| 3. Migrate content | Template edits in the copy (footer, product.json, brand, page and species templates). Then products one brand at a time: Vet company `**`, brand symbols if standardized, remove typed footnotes, add missing markers, fix the article text | Product and metafield edits are live as soon as they're saved, while the published theme is still the old one. So this runs right before or right after publishing, brand by brand | Before and after JSON per product in `/root/backups/claims-footnotes-YYYYMMDD/` plus a CSV here; a revert script puts the originals back |
| 4. Publish | Publish the copy. Remove the footer's typed footnote. Keep legacy mode on 1 to 2 weeks, then turn it off when the QA scan is clean | Yes | Republish the previous theme in one click; revert content from the backups |

### Test plan

| Page | Expected |
|---|---|
| `/products/cosamin-ds` (parent), then switch to each child | `▲` combined footnote and `*` FDA near the end of main. No Vet footnote in main unless the product-template Vet sections stay; if so `**` Vet survey too. Footnote matches after each switch |
| `/products/cosm-asu-hum-cap-90ct`, an Avmacol parent such as `avmacol®-extra-strength` | as above |
| A Dasuquin product, e.g. `nutramax-dasuquin-for-small-to-medium-dogs-joint-h…` | `◆, **` Vet survey once. The ingredients tab `▲` notes aren't linked |
| A Cosequin dog product and horse product (`▼` and `*` brand claims) | `▼, **` in legacy mode, then `◆, **` after migration |
| A Denamarin (`★`) and a Welactin (`△`) product | Vet survey with the right symbols |
| `/pages/brand/cosamin`, `/pages/brand/avmacol`, `/pages/cosamin-about`, `/pages/avmacol-about`, `/pages/avmacol-faq`, `/pages/species/human` | `▲` combined and `*` FDA. Footer shows the `**` footnote only if the marquee is kept on those pages |
| `/pages/brand/dasuquin`, `/pages/dasuquin-about`, `/pages/brand/cosequin`, `/pages/cosequin-dogs`, `/pages/cosequin-horses`, `/pages/denamarin-about` | Vet survey footnote only |
| `/` home, `/collections/all`, search "cosamin", cart with one Consumer Care and one Vet item | `**` Vet survey, plus FDA only where a Consumer Care card is shown |
| `/blogs/news/cosequin-partners-with-will-coleman…` ("5* Eventer"), `/pages/california-job-applicant-privacy-policy` ("YES*") | no FDA footnote |
| Where-to-buy dialog, quick-add modal | footnote added inside the dialog when the claim is there |
| Keyboard and screen reader (VoiceOver, NVDA) | marker reads, then its footnote; focus ring visible |
| JavaScript off | server footnotes present; markers not linked |

---

## 9. Open questions

1. **One Vet brand symbol?** Should every Vet brand claim use `◆` (Cosequin `▼`, Denamarin `★`, Welactin `△` and Dasuquin `♦` change), or does each brand keep its own symbol? Either way the footnote label lists the symbols found, e.g. `▼, **`.
2. **Does one source cover narrower surveys?** Can "Survey conducted among veterinarians who recommend animal supplements." cover brand claims that now cite narrower surveys? Today's wording includes "Among veterinary brands… oral joint health supplements" (Dasuquin), "Among retail brands…" (Cosequin, including "#1 … Retail Joint Health Supplement Brand"), "liver support supplements" (Denamarin), "omega-3 supplements" (Welactin) and "small animal veterinarians".
3. **Cosamin's extra sentence.** Cosamin's typed footnote adds "Human supplements are sold by Nutramax Laboratories Consumer Care, Inc." Keep it in the combined `▲` footnote, or drop it since the footer already says it?
4. **Vet claims on Consumer Care pages.** Should Vet company claims appear there at all? This covers the two Vet sections in `product.json`, the footer marquee and the where-to-buy "#1 Veterinarian Recommended" badge. If yes, they get `**` and the Vet footnote; if no, hide them by division.
5. **FDA placement.** Is the FDA "box" the FDA paragraph inside each Consumer Care product description? Should the automatic FDA footnote be added as well, or replace the typed copies? The typed copies are inside descriptions and in 5 templates, and the wording and case differ.
6. **Footnote position.** Is "end of main content" close enough to the claim, or must some sections, such as under the product title or buy box, have their own footnote block?
7. **The 251 claims with no marker.** Should markers be added, including the 169 short descriptions under product titles?
8. **Feeds.** Google, the Shop app and the Amazon and Chewy CSVs use the raw description. Must the footnotes stay in those, which means keeping them hidden in descriptions?
9. **Ratings claims.** Should ratings claims (Dasuquin "Over eighty thousand 5 star ratings…△") become registry footnotes too?
10. **Data cleanup.** OK to set a brand on the 101 products without one, fix the one Avmacol product with vendor "Veterinary Sciences", and decide the division for the 12 "Nutramax Staging" products?
