Creating your site
Docusaurus was created to hopefully make it super simple for you to create a site and documentation for your open source project.
După instalare și preparare, mare parte din munca pentru a crea un site de bază pentru documentele tale este deja completă.
Structură Site
Your site structure looks like the following:
root-directory
├── docs
└── website
├── blog
├── core
│ └── Footer.js
├── package.json
├── pages
├── sidebars.json
├── siteConfig.js
└── static
This assumes that you removed the example
.md
files that were installed with the initialization script.
All of your documentation files should be placed inside the docs
directory as markdown .md
files. Any blog posts should be inside the blog
directory.
The blog posts must be formatted as
YYYY-MM-DD-your-file-name.md
Crează-ți Site-ul tău de bază
Pentru a crea un site complet funcțional, trebuie doar să urmezi câțiva pași:
Add your documentation to the
/docs
directory as.md
files, ensuring you have the proper header in each file. One example header would be the following, whereid
is the link name (e.g.,docs/intro.html
) and thetitle
is the webpage's title.--- id: intro title: Getting Started --- My new content here..
Add zero or more docs to the
sidebars.json
file so that your documentation is rendered in a sidebar if you choose them to be.
Dacă nu adaugi documentația ta la fișierul
sidebars.json
, documentele vor fi redate, dar vor putea avea link-uri numai din alte documentații și să fie vizitate cu URL-ul cunoscut.
- Modify the
website/siteConfig.js
file to configure your site, following the comments included in the docs and thewebsite/siteConfig.js
to guide you. - Create any custom pages and/or customize the
website/core/Footer.js
file that provides the footer for your site. - Place assets, such as images, in the
website/static/
directory. - Rulează site-ul pentru a vedea rezultatele schimbărilor tale.
cd website
yarn run start # or `npm run start`
# Navigate to http://localhost:3000
Special Customization
Docs Landing Page
If you prefer to have your landing page be straight to your documentation, you can do this through a redirect.
- Remove the
index.js
file from thewebsite/pages
directory, if it exists. - Add a custom static
index.html
page in thewebsite/static
directory with the following contents:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8" />
<meta
http-equiv="refresh"
content="0; url=docs/id-of-doc-to-land-on.html"
/>
<script type="text/javascript">
window.location.href = 'docs/id-of-doc-to-land-on.html';
</script>
<title>Your Site Title Here</title>
</head>
<body>
If you are not redirected automatically, follow this
<a href="docs/id-of-doc-to-land-on.html">link</a>.
</body>
</html>
You will get the
id
of the document to land on the.md
metadata of that doc page.
Blog Only
You can also use Docusaurus to host your blog only.