More and more readers do not read an article to the end anymore. They copy it into ChatGPT or Claude and ask their own questions. I wanted to make that easy on Sitecore sites, so I built a small open-source module: Sitecore.MarkdownForAI. It adds an Ask AI button to your pages, and gives the AI assistant a clean copy of the page to read.
It works on Sitecore 10.1 to 10.5 with MVC renderings.
The Problem: AI Reads Your Footer Too
When an AI assistant opens an article page, it gets the full HTML: the mega menu, the search box, the cookie banner, the footer with forty links and kilobytes of script. The article is in there somewhere. The assistant has to dig it out, spends its context on the noise, and sometimes answers from the footer instead of the article.
What the Module Does
Two things:
- An Ask AI button. Readers pick ChatGPT, Claude or Perplexity from a dropdown, and the assistant opens with the page already in the prompt.
- A Markdown version of every page. Add
.mdto any URL and you get the same page as Markdown, without the header, menus or footer. This is the URL the button hands to the assistant.
https://www.example.com/articles/dental-care-for-dogs the page, with the Ask AI button
https://www.example.com/articles/dental-care-for-dogs.md the same page as Markdown
Here is a sample article page on Sitecore MVC, with a header, menu and search box, and the Ask AI button under the summary:
The Ask AI Button
The module ships with ChatGPT, Claude and Perplexity. On my test site I added Copilot and turned Perplexity off, just by editing items, which is what you see above. The dropdown has one entry per assistant, plus two more:
- Open in ChatGPT / Claude / Perplexity: opens the assistant in a new tab with a prompt like "Read this page so I can ask you questions about it: https://www.example.com/articles/dental-care-for-dogs.md".
- Copy page as Markdown: copies the clean page to the clipboard, for any other AI tool.
- View as Markdown: opens the
.mdversion in a new tab.
Nothing about the button is hard-coded. New assistants show up every few months, and the prefill links they accept (such as https://chatgpt.com/?q=) are not documented public APIs, so they can change. Everything is a Sitecore item under /sitecore/system/Modules/Markdown For AI/Ask AI:
| Item | Field | Values |
|---|---|---|
| Ask AI (settings) | Button Label | Button text, for example "Ask AI about this page" |
| Prompt | Text sent to the assistant. {url} = Markdown URL, {page} = page URL, {title} = page title | |
| Show Copy Markdown | Checked: show Copy page as Markdown | |
| Show View Markdown | Checked: show View as Markdown | |
| Max Link Length | Longest assistant link before the page is copied to the clipboard instead (default 6000) | |
| ChatGPT, Claude, Perplexity or any assistant you add | Assistant Name | For example ChatGPT |
| Link Pattern | An https link where {prompt} is replaced with the prompt, for example https://claude.ai/new?q={prompt}. Without {prompt}, the page is copied to the clipboard and the assistant opens, ready to paste | |
| Menu Label | Menu text (empty: "Open in" and the name) | |
| Hint | Second line of the menu entry | |
| Prompt | A prompt for this assistant only (empty: the Ask AI prompt) | |
| Icon | A small image from the Media Library | |
| Enabled | Unchecked: hidden from the dropdown |
To add an assistant, an editor inserts one item and publishes. No code, no deploy. The dropdown follows the content tree order. For a different set per site, create another Ask AI settings item and pick it as the rendering's data source. Upgrades never overwrite these items.
The button is a rendering called Ask AI. You can add it in three ways:
- Once for every article: add it to the article template's Standard Values.
- Per page: put an
ask-aiplaceholder near the article title, and editors can add the button in the Experience Editor. - In code: call
@Html.AskAi()in a view.
The Markdown Version
For the sample article page shown earlier, this is what /articles/dental-care-for-dogs.md returns:
---
title: "Dental Care for Dogs: A Simple Home Routine"
description: "Why dental disease is so common in dogs, the signs to look for, and a five-minute daily routine."
url: "https://www.example.com/articles/dental-care-for-dogs"
language: "en"
last_updated: "2026-10-29"
---
# Dental Care for Dogs: A Simple Home Routine
## Why it matters
Most dogs show some sign of dental disease by the age of three. ...
## What else helps
| Option | How it helps | Notes |
| --- | --- | --- |
| Dental chews | Scrape plaque mechanically | Pick a size that cannot be swallowed whole |
No header, no menu, no newsletter, no footer. Headings, lists, tables and links stay. Every Markdown response also sends Link: rel="canonical" pointing to the HTML page and X-Robots-Tag: noindex, so search engines keep indexing the HTML page and not the copy.
How it decides what goes in:
- The layout is never rendered, only its placeholders. Anything the layout file writes directly (a header partial, scripts) is gone automatically.
- Excluded placeholders: renderings in the placeholders you list (by default
header|footer|navigation|nav|breadcrumb) are skipped at any depth, before their controller or view runs. Dynamic placeholders such asfooter-{GUID}-0match too. data-md-ignoreon any element removes it, for example a share bar inside the article body.
The .md suffix is removed before Sitecore resolves the item, so wildcard items, custom item resolvers and language prefixes resolve the same item as for the HTML page. Only Request.RawUrl still shows the .md URL, so a custom resolver should read Request.Path instead.
Caching
Rendering a page and converting it costs CPU, so the finished Markdown is cached in memory and served early in httpRequestBegin, before Sitecore resolves the layout. On my test instance, the first request for an article took about 130 ms and the cached ones about 15 ms.
- Cleared on publish, on every server.
- Only successful pages are cached. Not-found and error pages are never stored.
- Never cached: logged-in visitors, and content from the
masterdatabase (local development and preview). - Your HTML rendering cache is not touched. A Markdown request does not read or write Sitecore's rendering cache.
How to Install
- Install
Sitecore.MarkdownForAI-<version>.zipwith the Installation Wizard. If you deploy through CI, there is also a NuGet package and the Sitecore CLI serialization. - Rename
App_Config/Include/MarkdownForAI/z.MarkdownForAI.Site.config.exampletoz.MarkdownForAI.Site.configand set your site name. Your settings live only in this file, so upgrades never touch them. - Publish the
Markdown For AIitems. - Add the Ask AI rendering to your page.
The .md pages are served on ContentDelivery and Standalone servers. All items live under Modules folders, so a Helix solution that serializes its own Foundation, Feature and Project folders never deletes them.
Settings
Most sites only change Sites and ExcludedPlaceholders. Every setting goes in z.MarkdownForAI.Site.config with the MarkdownForAI. prefix:
<setting name="MarkdownForAI.Sites" set:value="mysite" />
| Setting | Default | Possible values |
|---|---|---|
Enabled | true | false turns off the .md pages |
Sites | website | Site names, pipe separated, or * for every site except Sitecore's own. On other sites the button sends the normal page URL |
Extension | .md | The suffix that asks for Markdown |
ExcludedPathPrefixes | /sitecore/|/-/|/api/|... | Paths never treated as Markdown requests |
ExcludedPlaceholders | header|footer|navigation|nav|breadcrumb | Placeholder keys left out, at any depth |
Placeholders | empty | Top-level placeholders to render, in this order. Empty: all on the page |
SkipTags | script|style|form|nav|... | HTML elements always removed |
IgnoreClasses | empty | CSS classes whose elements are removed |
IncludeImages | true | false drops images |
TitleFields | Title|Page Title|Heading | Fields for the title; the first non-empty one wins, then the display name |
DescriptionFields | Meta Description|...|Abstract | Fields for the description; the first non-empty one wins |
FrontMatterFields | title|description|url|language|last_updated | Front matter lines to write, or none |
CacheMinutes | 30 | Minutes to keep a page in memory. 0 turns the cache off |
CacheSizeMB | 100 | Memory limit of the cache |
CacheVaryByQueryString | false | true only if components change their output based on the query string |
NoCacheDatabases | master | Databases whose content is never cached |
NoIndexHeader | true | false stops sending X-Robots-Tag: noindex |
Scheme | empty | https to force it in generated URLs, for example behind an SSL offloader |
AskAi.ScriptUrl | /scripts/markdownforai/ask-ai.js | Where the button's script is served from. Empty: load it yourself |
What Is Not in This Version
I kept the first release small on purpose. These are not included:
- WebForms pages: only MVC layouts get a
.mdversion. On other layouts the button still works with the normal page URL. - llms.txt, field mappings, per-component rules and discovery headers. They are written up in the repository's
docs/extending.md, so they can come back when there is a need. - Local and intranet sites: the assistant must be able to reach the
.mdURL. On a local host, use Copy page as Markdown and paste it.
Wrapping Up
- Readers ask ChatGPT, Claude or Perplexity about your article with one click.
- The assistant reads a clean Markdown copy of the page, not your menus and footer.
- The assistants and the prompt are Sitecore items, so adding the next one is an editor task, not a deploy.
- Install the package, set your site name, publish, and add the rendering.
If you are working on something similar, I would love to hear how you approached it. If you find the module useful, a star on GitHub helps with visibility.
Links
- Sitecore.MarkdownForAI on GitHub
- Configuration guide
- The Ask AI web component (works on any site)



