-
-
Notifications
You must be signed in to change notification settings - Fork 111
Content negotiation for Markdown files #577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content negotiation for Markdown files #577
Conversation
8175fba to
6df2ace
Compare
joseluisq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
I've updated following your recommandations, updated tests and added integration tests. Let me know if you need any further modification. |
joseluisq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last changes to make, then we should be ready.
f551a01 to
4c30fd8
Compare
|
I've added 2 commits to let you check changes more easily, feel free to squash/remessage them |
joseluisq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All fine from my side.
Thanks!
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.