-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
feat(v2): add meta RSS/Atom feed links to head #2000
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 0bb95bd |
Deploy preview for docusaurus-preview ready! Built with commit 0bb95bd |
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.
Although this will be great, this isnt the best way to do it and feels unclean. Finding options from siteconfig.presets is not a bulletproof way. Presets are collection of plugins and it might not even enable feedOptions setting as well. Its also very possible for user to not use preset-classic and just use plugin-content-blog and their own theme component
- The right way is to actually do this in the blog plugin itself but we are still lacking a “setHead” hooks plugin API
by the way feedOptions is optional. If not enabled, no feed at all
|
Fairly enough, I thought about it, but since there was no corresponding API, I decided that as a temporary solution we could go this way (given that the blog plugin is in preset by default, then its functionality will always be there). BTW, what is the best way to implement a |
Sorry for that, but I think its better not to provide the temporary solution yet because I am afraid since its the official package, someone will start swizzling and following it. I think api wise we need to think about the “setHead” (this will help google analytics plugin to set “<link rel preconnect”>) which makes our web perf faster too) and “setBody” (this will solve the dark mode flash too) First I think we need to design the public API first. As for implementation, in prod we render the HTML through this https://github.com/facebook/docusaurus/blob/master/packages/docusaurus/src/client/serverEntry.js In dev server, i think we need to hook to the htmlwebpackplugin. Summon API guru @yangshun |
Or maybe we just need to somehow connect it here for Head. https://github.com/facebook/docusaurus/blob/master/packages/docusaurus/src/client/App.js |
I agree, perhaps there will not be a quick/easy solution. In addition, I still do not really understand how to implement for example the setHead hook, it is quite difficult for me :( |
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.
Let's use injectHtmlTags hook now.
Checking if feedOptions is defined in https://github.com/facebook/docusaurus/blob/master/packages/docusaurus-plugin-content-blog/src/index.ts
@endiliey done ✔️, but I'm not sure if this is the correct code, TS typing confuse me 😕 |
Looks like I'm stuck, an error occurs now :( |
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 fixed it.
Thanks |
@endiliey thank you! I am too blunt for TS :| |
Motivation
When the blog is enabled, you need to add links to the feeds of this blog.
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
See HTML markup.