👀# How to Add a “View as Markdown” Button to Shopify Product Pages

This guide explains how to add a custom “View as Markdown” button to your Shopify product pages.

The button will appear on each product page and open a URL like:

<https://llms.YOURDOMAIN/>{{ product.handle }}.md

⚠️ This button will only show for specific products — you must define those products by their handle.


🔧 Step-by-Step Instructions

1. Open Shopify Theme Code Editor

  1. In your Shopify admin, go to:

    Online Store → Themes

  2. Find your live theme (or preview theme).

  3. Click Actions → Edit Code.


2. Find the Product Template

Locate the Liquid template that renders the product page. This is often:

Theme using Sections Everywhere (OS 2.0+)

/sections/main-product.liquid
/sections/product-template.liquid
/sections/product-information.liquid
/sections/product-content.liquid

Traditional or older themes:

/templates/product.liquid
/templates/product.json (combined with a section defined via main schema)

Decide where you want the button to appear on the product page — for example:

  • Below the product title - {{ product.title }}

  • Above or below the description - {{ product.description }}

  • In a custom section at the bottom of the page

Visual Examples of Placement Options:

Below Product Title

Below Product Subheader

Below or Included in Product Description

You may also choose to change the wording from “View as Markdown” to:

  • “See AI-Readable Version”

  • “View ChatGPT-Optimized Page”

  • “View AI Summary (Markdown)”


3. Replace YOURDOMAIN With Your Actual Domain

Before adding the button, replace YOURDOMAIN in the code below with your actual domain — without https:// and without a trailing slash. For example, if your domain is:

<https://www.microsoft.com>

Replace in the below code:

<https://llms.YOURDOMAIN/>{{ product.handle }}.md

With:

<https://llms.microsoft.com/>{{ product.handle }}.md

4. Replace PRODUCTHANDLE-# and Add Your Product Handles

Before pasting the code:

  • ✅ Replace PRODUCTHANDLE-# with the exact handles you want this button to appear on

For example, if the product URL you are using are:

https://gloriousgaming.com/products/3-barebones-keyboard
https://gloriousgaming.com/products/model-o-2-wireless-mouse

Replace in the below code:

{% if product.handle == 'PRODUCTHANDLE-1' or product.handle == 'PRODUCTHANDLE-2' %}

With:

{% if product.handle == '3-barebones-keyboard' or product.handle == 'model-o-2-wireless-mouse' %}

You can add as many product handles as you like—just connect them using “or”, like in the example above.

5. Paste the Button Code

All you have to do is add the button code once to your product page and it will automatically adapt the hyperlink to the right product based on the product handle.

Add the following HTML snippet within your product template file:
{% if product.handle == 'PRODUCTHANDLE-1' or product.handle == 'PRODUCTHANDLE-2' %}
	<a
	  style="
	    display: inline-flex;
	    align-items: center;
	    gap: 6px;
	    font-size: inherit;
	    font-weight: inherit;
	    border: none;
	    background-color: inherit;
	    color: inherit;
	    cursor: pointer;
	    text-decoration: none;
	  "
	  href="https://llms.YOURDOMAIN/{{ product.handle }}.md"
	  target="_blank"
	  rel="noopener noreferrer"
	  aria-label="View as Markdown"
	>
	  <svg
	    style="
	      width: 16px;
	      height: 16px;
	      color: inherit;
	    "
	    stroke="inherit"
	    viewBox="0 0 208 128"
	    xmlns="http://www.w3.org/2000/svg"
	    aria-hidden="true"
	  >
	    <path
	      clip-rule="evenodd"
	      d="M15 10a5 5 0 00-5 5v98a5 5 0 005 5h178a5 5 0 005-5V15a5 5 0 00-5-5zM0 15C0 6.716 6.716 0 15 0h178c8.284 0 15 6.716 15 15v98c0 8.284-6.716 15-15 15H15c-8.284 0-15-6.716-15-15z"
	      fill-rule="evenodd"
	    ></path>
	    <path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"></path>
	  </svg>
	  See AI version of the page
	</a>
{% endif %}


✅ What It Does

  • Renders a "View as Markdown" button only on selected product pages.

  • Clicking it opens the markdown file at:

    https://llms.YOURDOMAIN/{{ product.handle }}.md

  • Opens in a new tab.


📎 Example

If your product URL is:

<https://YOURDOMAIN/products/3-barebones-keyboard>

The button links to:

<https://llms.gloriousgaming.com/3-barebones-keyboard.md>
Impact of Linking to Subdomain Content on Main Domain SEO
Effect on Main Domain SEO
Description

Positive (if relevant/visible)

Improves UX, topical authority, site structure

Neutral (most cases)

No direct ranking boost, but supports brand ecosystem

Negative (if abused)

Possible link dilution or penalties for manipulative linking

Positive Effects

1. Enhanced User Experience

  • Visible, relevant links to high-quality subdomain content can improve user navigation and satisfaction.

  • If users find helpful resources via these links, engagement metrics (like time on site and reduced bounce rate) may improve—factors that search engines consider for ranking.

2. Demonstrates Topical Authority

  • Linking to in-depth, authoritative markdown resources on your subdomain signals to search engines that your main domain is a valuable hub for comprehensive information.

  • This can strengthen your site’s perceived expertise and relevance in its niche.

3. Potential for Rich Snippets and Sitelinks

  • Well-structured linking can help search engines understand your site architecture, which may lead to enhanced search features like sitelinks or rich results.

Neutral or Minimal Effects

1. No Direct SEO Boost from Outbound Links

  • Linking to a subdomain (even your own) is treated similarly to linking to an external site. It does not directly increase the main domain’s rankings.

  • However, if the subdomain becomes authoritative and earns backlinks, the overall brand ecosystem can benefit indirectly.

2. Crawl Budget Considerations

  • For very large sites, excessive outbound linking could marginally impact crawl efficiency, but this is rarely a concern for most businesses.

Potential Negative Effects (If Misused)

1. Link Dilution

  • If you add too many outbound links (including to subdomains) on a single page, you may dilute the value passed to each link. This is only an issue if overdone.

2. Perceived Manipulation

  • If links appear manipulative (e.g., hidden, irrelevant, or stuffed with keywords), both the main domain and subdomain could be penalized.

Best Practices

  • Use clear, descriptive anchor text that matches the linked content’s purpose.

  • Keep links contextually relevant—add them where they genuinely help users.

  • Avoid excessive linking or creating doorway pages solely for SEO.

When the LLM accesses the markdown, it should be able to access a number of different versions of the product page based on what’s best for an individual prompt. For example, rather than having 1 markdown for 1 product page “Best sneakers for running,” it could lead the LLM to markdowns for “Best sneakers for walking” and “comfy shoes for nurses” that are each optimized for the given prompt.

If you have any issues or questions, feel free to reach out to the Because team via slack, chat, or email support@trybecause.com. Feel free to book time with us here to walk through this set up.

Last updated