Tinasaurus

repository·main·Indexed 42 days ago

https://github.com/tinacms/tinasaurus

A demonstration project built with Docusaurus 3 and TinaCMS that showcases how to integrate a visual CMS with a static site generator.

Tokens
5.9K
Snippets
31
Records
38
Agent score
52%

What's inside Tinasaurus

  1. Quickstart with Tinasaurus

    main

    To get started with Tinasaurus, install the dependencies and launch the development server. This will automatically open the website in your browser. Once running, you can access the CMS interface at http://localhost:3000/admin to begin editing content.

    $ npm install && npm run dev

    Or using yarn

    $ yarn && yarn dev
  2. Configure sidebar label and position via Markdown metadata

    main

    You can customize how a document appears in the automatically generated sidebar by adding frontmatter metadata to the top of your Markdown file. Use sidebar_label to change the display name and sidebar_position to control its order.

    ---
    sidebar_label: "Hi!"
    sidebar_position: 3
    ---
    
    # Hello
    
    This is my **first Docusaurus document**!
  3. Create a new documentation version in Docusaurus

    main

    To release a specific version of your documentation (e.g., version 1.0), use the Docusaurus CLI command. This process copies your current docs folder into a new directory under versioned_docs/version-1.0 and generates a versions.json file to track the release.

    After running this command, your site will have two distinct paths:

    • The versioned docs (e.g., 1.0) at /docs/.
    • The current (upcoming/unreleased) docs at /docs/next/.
    npm run docusaurus docs:version 1.0
  4. Translate a document

    main

    To translate a specific document, you must copy the original file into the Docusaurus i18n directory structure. For a file located at docs/intro.mdx, create the corresponding path under i18n/[locale]/docusaurus-plugin-content-docs/current/ and then translate the content of the copied file.

    mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
    
    cp docs/intro.mdx i18n/fr/docusaurus-plugin-content-docs/current/intro.md
  5. Update existing versioned documentation

    main

    When using Docusaurus versioning, you must edit files in their specific directories to target the correct URL path:

    • To update a released version: Edit files located in versioned_docs/version-[VERSION_NAME]/ (e.g., versioned_docs/version-1.0/hello.md updates /docs/hello).
    • To update the upcoming/unreleased docs: Edit files in the main docs/ folder (e.g., docs/hello.md updates /docs/next/hello).
  6. Manage Docusaurus blog content

    main

    Docusaurus blogging features are powered by the @docusaurus/plugin-content-blog plugin. To manage blog content:

    • Adding Posts: Add Markdown files or folders directly to the blog directory.
    • Organizing Media: Use folders for blog posts to co-locate images with the post content (e.g., blog/my-post/index.md and blog/my-post/image.png).
    • Authors: Define regular blog authors in an authors.yml file.
    • Tags: Use the tags field in the post frontmatter to categorize content.
    • Dates: The blog post date can be automatically extracted from the filename (e.g., 2019-05-30-welcome.md or 2019-05-30-welcome/index.md).
  7. Build Tinasaurus for production

    main

    Generate static content for production. This command outputs the static files into the build directory, which can then be hosted on any static site hosting service.

    $ npm run build

    Or using yarn

    $ yarn build
  8. Create a blog post in Docusaurus

    main

    To create a new blog post, create a Markdown file within the blog/ directory. The filename should follow a date-based pattern (e.g., YYYY-MM-DD-slug.md) to ensure proper ordering. Each post requires a YAML frontmatter block containing metadata such as slug, title, authors, and tags.

    ---
    slug: greetings
    title: Greetings!
    authors:
      - name: Joel Marcey
        title: Co-creator of Docusaurus 1
        url: https://github.com/JoelMarcey
        image_url: https://github.com/JoelMarcey.png
      - name: Sébastien Lorber
        title: Docusaurus maintainer
        url: https://sebastienlorber.com
        image_url: https://github.com/slorber.png
    tags: [greetings]
    ---
    
    Congratulations, you have made your first post!