Content negotiation for Markdown files#577
Merged
joseluisq merged 7 commits intostatic-web-server:masterfrom Nov 6, 2025
Merged
Content negotiation for Markdown files#577joseluisq merged 7 commits intostatic-web-server:masterfrom
joseluisq merged 7 commits intostatic-web-server:masterfrom
Conversation
8175fba to
6df2ace
Compare
joseluisq
requested changes
Nov 4, 2025
Collaborator
joseluisq
left a comment
There was a problem hiding this comment.
I like the idea of content negotiation. In general, this could be extended in the future to support, for example, language and media (e.g., images) negotiation.
I gave the MR a first review. I will take a second look in the coming hours.
If something is not clear or you need help, just let me know.
27d7c97 to
c2ab9bc
Compare
Contributor
Author
|
I've updated following your recommandations, updated tests and added integration tests. Let me know if you need any further modification. |
joseluisq
requested changes
Nov 5, 2025
Collaborator
joseluisq
left a comment
There was a problem hiding this comment.
Last changes to make, then we should be ready.
f551a01 to
4c30fd8
Compare
Contributor
Author
|
I've added 2 commits to let you check changes more easily, feel free to squash/remessage them |
joseluisq
approved these changes
Nov 6, 2025
Collaborator
joseluisq
left a comment
There was a problem hiding this comment.
All fine from my side.
Thanks!
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.
Description
This PR adds a
--accept-markdown/SERVER_ACCEPT_MARKDOWNfeature. Once enabled, if aGETorHEADrequest is received forpath/to/filewithAccept: text/markdownheader, the server checks if a markdown version exists and send it as response. Checked paths are:path/to/file.mdpath/to/file.html.mdpath/to/file/index.html.mdThus it helps to get an existing markdown file of an HTML page on a website which respects llms.txt standard. It states that:
Agents/LLMs can ask for a page with
Accept: text/markdownand get directly the markdown version. Learn more in added documentation.Motivation and Context
We build our documentation with Hugo which now includes a native llms.txt support. We use SWS as static server but it lacks
Acceptheader configuration/support. So I thought about adding this feature to allow a better discovery of our content in markdown format.How Has This Been Tested?
I've added tests, tried it with our documentation.