How can I add custom scripts in index.html's head part in Docusaurus V2?

后端 未结 3 702
渐次进展
渐次进展 2021-02-14 14:51

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

3条回答
  •  鱼传尺愫
    2021-02-14 15:26

    Instead of React Helmet, use '@docusaurus/Head' instead.

    import Head from '@docusaurus/Head';
    
    function Home() {
      const context = useDocusaurusContext();
      const { siteConfig = {} } = context;
      return (
        
          
            
          
        
      );
    }
    

    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!

提交回复
热议问题