Skip to content

feat: Allow markdown content via 'md' suffix - #554

Merged
linkdotnet merged 2 commits into
masterfrom
feat/allow-md-suffix
Oct 20, 2026
Merged

linkdotnet merged 2 commits into
masterfrom
feat/allow-md-suffix

Conversation

@linkdotnet

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Markdown title escaping, index query efficiency, and disabled-mode documentation need correction.

3 open issues
What changed in this PR

Adds URL-based Markdown access and discovery for published posts under EnableMarkdownForLlms.

Changes:

  • Supports .md URLs regardless of the Accept header.
  • Adds alternate Markdown links and a /llms.txt index.
  • Extends integration coverage and configuration documentation.
File Description
tests/​LinkDotNet.Blog.IntegrationTests/​BlogPostMarkdownTests.cs Tests suffix URLs, discovery links, and disabled behavior.
src/​LinkDotNet.Blog.Web/​Features/​ShowBlogPost/​ShowBlogPostPage.razor Advertises the Markdown version in page metadata.
src/​LinkDotNet.Blog.Web/​Features/​ShowBlogPost/​BlogPostMarkdownMiddleware.cs Handles .md requests and alternate-link headers.
src/​LinkDotNet.Blog.Web/​Features/​Components/​OgData.razor Allows additional head content.
src/​LinkDotNet.Blog.Web/​Controller/​LlmsTxtController.cs Generates the published-post discovery index.
docs/​Setup/​Configuration.md Documents Markdown URLs and discovery behavior.

Review effort: Balanced

Comment thread docs/Setup/Configuration.md Outdated
- Appending `.md` to a blog post url (`/blogPost/{id}.md` or `/blogPost/{id}/{slug}.md`) returns markdown regardless of the `Accept` header, for agents that can't set headers.
- HTML blog post pages advertise the markdown version via a `Link: </blogPost/{id}/{slug}.md>; rel="alternate"; type="text/markdown"` header and a `<link rel="alternate" type="text/markdown">` tag.
- `/llms.txt` (see [llmstxt.org](https://llmstxt.org)) lists the blog name, introduction and all published blog posts with links to their markdown version.
- If the setting is `false` or missing, the `Accept` header is ignored and HTML is always returned, `.md` urls render the HTML page, no `Link` header or `<link>` tag is emitted and `/llms.txt` returns `404`.
}

sb.Append("## Blog posts\n\n");
var blogPosts = await blogPostRepository.GetAllAsync(f => f.IsPublished, b => b.UpdatedDate);
var blogPosts = await blogPostRepository.GetAllAsync(f => f.IsPublished, b => b.UpdatedDate);
foreach (var blogPost in blogPosts)
{
sb.Append("- [").Append(blogPost.Title).Append("](").Append(baseUrl).Append("/blogPost/").Append(blogPost.Id);
@linkdotnet
linkdotnet merged commit 2944352 into master Oct 20, 2026
3 checks passed
@linkdotnet
linkdotnet deleted the feat/allow-md-suffix branch October 20, 2026 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants