We are making a website with Docusaurus V2.
In Docusaurus V1, there is a scripts
setting in siteConfig.js
to cusutimize html\'s head content. B
I have no idea if you solved this. Your friend is the Lifecycle API.
Specifically you want this: https://v2.docusaurus.io/docs/lifecycle-apis#injecthtmltags
Build a plugin and use the above. D2 is looking pretty strong, I wish they'd release a stable version 2 soon!
Instead of React Helmet, use '@docusaurus/Head'
instead.
import Head from '@docusaurus/Head';
function Home() {
const context = useDocusaurusContext();
const { siteConfig = {} } = context;
return (
<Layout>
<Head>
<script src="..."></script>
</Head>
</Layout>
);
}
We're working on this feature so you can add this via docusaurus.config.js
. You can follow this PR to track the progress: https://github.com/facebook/docusaurus/pull/1831.
We'll release v2.0.0-alpha.27
soon so that you can try it out. Thanks for your patience!
i am also developing a blog which is based on docusaurus.
and it provides the functionality to add script in head tag.
follow below steps :
1. Open siteConfig.js
2. // Add custom scripts here that would be placed in tags.
scripts: ['https://buttons.github.io/buttons.js'],