Docusaurus Documentation

website·Indexed 29 days ago

https://statuesque-centaur-3dbfb8.netlify.app/

A static-site generator (Jamstack) designed for quickly setting up websites. It features built-in support for Markdown and React pages, documentation versioning, i18n translation, and a blogging system with tags and RSS feeds.

Tokens
2.6K
Snippets
25
Records
32
Agent score
75%

What's inside Docusaurus

  1. Extend Docusaurus layouts using React

    Docusaurus is powered by React, allowing developers to extend or customize the website layout. You can create custom components or pages while maintaining the existing global header and footer.
  2. Create interactive blog posts using MDX in Docusaurus

    Docusaurus blog posts support MDX, which allows the use of React components and JSX directly within Markdown files. This enables the creation of interactive elements, such as buttons with event handlers, inside blog content.
    <button onClick={() => alert('button clicked!')}>Click me!</button>
  3. Generate a new Docusaurus site using the classic template

    You can create a new Docusaurus project using the classic template by running the npm init command. This process automatically adds the template to your project and installs all necessary dependencies.
    npm init docusaurus@latest my-website classic
  4. Limit blog post length in list views using truncate comments

    To limit the amount of content displayed for a blog post in the list view, insert a <!-- truncate --> HTML comment within the post content. Content appearing after this comment will be hidden in the list view and only visible on the full post page.
    This text will appear in the blog list view.
    <!-- truncate -->
    This text will only appear on the full blog post page.
  5. Create a new document in Docusaurus

    Documents in Docusaurus are groups of pages connected via sidebars, previous/next navigation, and versioning. To create a new document, create a Markdown file within the docs/ directory. For example, creating docs/hello.md will make the document available at /docs/hello.
    # Hello
    
    This is my **first Docusaurus document**!
  6. Start the Docusaurus development server

    After generating your site, navigate into the project directory and run the start script. This builds the website locally and serves it at http://localhost:3000/. The server supports hot-reloading, meaning changes made to files (such as docs/intro.md) will be displayed automatically.
    cd my-website
    npm run start
  7. Create a new documentation version in Docusaurus

    Docusaurus allows you to snapshot your current documentation into a specific version. Running the versioning command copies the contents of the docs folder into a new directory under versioned_docs/ and updates the versions.json file.

    After creating a version (e.g., '1.0'), the site will host two sets of docs:

    • The versioned docs (e.g., 1.0) at /docs/.
    • The current, unreleased development docs at /docs/next/.
    npm run docusaurus docs:version 1.0