Markdown feeds experiment - #855
Conversation
… our own namespace to avoid conflicts and document how to update in the future
…er markdown at the right times
…Ensure our Vary header doesn't overwrite any other heads that are set
…eaders. Don't add discovery link to password protected posts or non-public posts
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #855 +/- ##
=============================================
- Coverage 74.57% 74.45% -0.13%
- Complexity 3132 3468 +336
=============================================
Files 132 150 +18
Lines 12213 13138 +925
=============================================
+ Hits 9108 9782 +674
- Misses 3105 3356 +251
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I've seen an increase in chatter recently around markdown content and how it's better to support this using content negotiation headers only and not support having separate URLs that serve markdown. This experiment adds both, with content negotiation being opt-in. I had debated changing that logic here to either strip out the stand-alone markdown URLs or make that opt-in and have content negotiation be the default mode. But in doing some more research, seems most sites that have adopted markdown accessible content have taken both approaches (content negotiation and separate markdown URLs). The main one against this is Vercel, which does content negotiation only. Also seems like it's inconsistent among AI tools, some send those headers, some do not. The biggest issue, particularly in WordPress, with content negotiation headers is that depending on the cache setup, you can end up with weird caching bugs. And some setups don't yet support the content negotiation headers. That's ultimately why we put that as opt-in. So after thinking about it more and doing more research, I think the approach this PR takes is likely the right one for now, supporting separate markdown URLs by default and allowing those that want / those that know it won't interfere with caching, to opt-in to content negotiation. That said, there were two things worth discussing:
cc / @jeffpaul |
What?
Closes #845
Adds a new experiment, Markdown Feeds, that when enabled introduces new markdown feeds for singular content and main archive feeds.
Why?
Having the ability to return content in markdown is useful for many situations, particularly for AI agents and machine readers.
How?
Markdown_Feedsexperiment class that registers needed hooksMarkdown_Singular_RendererandMarkdown_Feed_Renderer, that will render markdown for singular feeds and normal feedsMarkdown_Converterclass that provides a wrapper for converting HTML to Markdownincludes/Vendordirectory (alongside our encryption package) instead of including this at build time via composer. Ensure the file names match our autoloading process and add custom namespaces to avoid conflicts with other plugins using the same toolAccept: text/markdown<head>tag as wellwpai_markdown_singular_sectionsandwpai_markdown_feed_item_sectionsTo access a normal markdown feed, take the feed URL and append
/markdownor?feed=markdown, depending on if pretty permalinks are in use. Examples:https://example.com/feed/markdown,https://example.com/category/news/feed/markdownTo access a singular markdown feed, access the URL and append
?format=md, example:https://example.com/this-is-an-article?format=md.Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Fable 5, Opus 4.8
Used for: Putting together a plan and executing on that plan. Plan reviewed and modified by me and all code was reviewed and tested by me
Testing Instructions
Settings > AIand enable Markdown Feeds/feed/markdown?format=mdlinktag pointing to the markdown feedScreenshots or screencast
Changelog Entry