Repository navigation
feat: Allow markdown content via 'md' suffix - #554
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 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
.mdURLs regardless of theAcceptheader. - Adds alternate Markdown links and a
/llms.txtindex. - 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
| - 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.