Deploying the Documentation
Welcome to the final part of this tutorial! If you're here, then you're done with the complex part of this documentation process, and you can relax your shoulders. It is assumed that you are done making changes to the documentation you created, and all that's left is to deploy it for your users to access.
In this part, we will guide you through the deployment process and how to configure your project for deployment. Let's get started and make your documentation available to the world!
Building and deploying the documentation website
Build Process
Before deploying your documentation, you need to build the static files that will be served to your users. Follow these steps to build:
Open your command-line interface (CLI) and navigate to the root directory of your Docusaurus project.
Run the build command,
npm run build
(if you used npm as your project manager), to generate the static files for your documentation. This will compile the Markdown files and create the necessary HTML files, JavaScript bundles, and assets.
Deployment Options
Once you're done building the documentation, the next step is to deploy it. Here are some free deployment options you should consider:
GitHub Pages
Netlify
Vercel
Configuring deployment options
This involves setting up the necessary configurations that will connect your project to a hosting platform. GitHub Pages provides a free option for hosting your Docusaurus documentation. To deploy to GitHub Pages, follow these steps:
Ensure your project is a Git repository and hosted on GitHub.
Open the
docusaurus.config.js
file in the root directory of your project.Locate the
url
andbaseUrl
fields in thethemeConfig
section.Set the
url
field to the URL where your documentation will be hosted (e.g.,https://your-username.github.io
).Set the
baseUrl
field to the repository name of your project (e.g.,/repository-name/
).Commit and push the changes to your GitHub repository.
Navigate to the repository's settings on GitHub and scroll down to the GitHub Pages section.
Select the branch you want to deploy (typically
main
orrelease
) and save the configuration. Your Docusaurus documentation will now be accessible at the specified URL.
Whether you choose GitHub Pages, Netlify, or another hosting platform, ensure that your configurations align with the specific requirements of the chosen deployment option.
If you frequently update your documentation, consider enabling continuous deployment. This feature, which is available on platforms like Netlify and Vercel, automatically rebuilds and deploys your documentation whenever you push changes to your repository.
Conclusion
Congratulations on making it to the end of this tutorial! By now, your documentation website should be deployed and accessible to its users.
Throughout this tutorial, we covered various aspects of getting started with Docusaurus as a beginner in technical writing. We explored the entire process of documenting with Docusaurus. With this knowledge contained in this tutorial, you should be able to create professional and user-friendly documentation for your next project, as well as comfortably contribute to Open Source projects built with Docusaurus. Best of luck in your future technical writing endeavors!
Subscribe to my newsletter
Read articles from Levai Ágbàrà directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by