Skip to content

Here is a condensed guide on getting Docusaurus up and running.

INSTALLATION

  1. Install nodejs and yarn

    curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
    curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
    yum install nodejs yarn gcc-c++ make
    
  2. Verify node and yarn versions. Node >= 8.x and yarn >= 1.5 are required.

    $ date
    Sat Jul 28 19:16:48 CDT 2018
    $ rpm -qa | grep -e yarn -e nodejs
    nodejs-8.11.3-1nodesource.x86_64
    yarn-1.9.2-1.noarch
    $
    
  3. This will be utilizing git to manage your site. Create a directory for this and go into it and run the initialization command:

    mkdir -p /home/user/workspace/docusaurus/
    cd /home/user/workspace/docusaurus/
    npx docusaurus-init
    
  4. You can validate that the installation is functional, and that your Docusaurus root-directory (/home/user/workspace/docusaurus/ in this example) is properly created and populated with sample files by doing the following:

    cd /home/user/workspace/docusaurus/
    mv docs-examples-from-docusaurus docs
    cd website      
    mv blogexamples-from-docusaurus blog
    yarn start
    

The site will be published on port 3000. If you are ssh'ing in to a remote server, running "yarn start" can open a browser window if you are doing X forwarding. If it populates a demo site, you have configured everything correctly.

SETTING UP YOUR SITE

The basic structure of the site should be somewhat obvious now:

local folder function
docs Documentation
website/blog Blog
website/pages Top level pages
website/static Static assets
website/siteConfig.js Main configuration file for Docusaurus
website/core/Footer.js React component that you should customize that acts as your footer

DEPLOPYING YOUR SITE

REFERENCES