Help Adding Timestamp to Mailto Subject Line in JSON Template (Without Class or ID Access)

'm working on a custom page (page.contact-tech-support.json) where I need to add a timestamp to the subject line of a mailto: link (e.g., mailto:support@my-email.com?subject=CompanyPreformatted text Store Support Request - [timestamp]).

Here’s the challenge:

  • The mailto: link is inside a text block in a JSON template.
  • Shopify’s strict sanitization on type: text blocks does not allow id or class attributes on anchor tags, so I can’t directly target the link in JavaScript.
  • I’m using a script in theme.liquid to dynamically update the subject line with a timestamp using querySelector('.tech-support-link'), but since I can’t add a class, I can’t target the link reliably.

I’ve tried these options:

  • Using id or class on the link → blocked by Shopify sanitization.
  • Using custom_liquid → not supported in this template context.
  • Targeting the link by href substring (e.g., mailto:support@...) as a fallback, but it’s not always reliable or ideal.

:red_question_mark:What I Need Help With:

  1. Best practice for injecting a timestamp into a mailto subject line when you can’t add identifiers to the <a> tag.
  2. Whether there’s a cleaner way to output this link in a block that does allow class or id (e.g., through custom-liquid or another block type).
  3. Where Shopify recommends placing this type of JavaScript logic in an OS 2.0 store setup (theme file, section, asset, etc.).

Any help or workarounds would be greatly appreciated!

Thanks in advance,
Seth

Can you use a liquid filter? Liquid filters: date