mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
The example in the getting started section was for an older version of yew, and didn't work with the latest version anymore. This commit copies the example from [yew's docs](https://docs.rs/yew/0.14.3/yew/#example) and includes minor adaptations to the text to match the code.
This website was created with Docusaurus.
What's In This Document
Get Started in 5 Minutes
- Make sure all the dependencies for the website are installed:
# Install dependencies
$ npm install
- Run your dev server:
# Start the site
$ npm start
Directory Structure
Your project file structure should look something like this
yew/
docs/
website/
core/
node_modules/
static/
css/
img/
package.json
sidebars.json
siteConfig.js
Editing Content
Editing an existing docs page
Edit docs by navigating to docs/ and editing the corresponding document:
docs/doc-to-be-edited.md
---
id: page-needs-edit
title: This Doc Needs To Be Edited
---
Edit me...
For more information about docs, click here
Adding Content
Adding a new docs page to an existing sidebar
- Create the doc as a new markdown file in
/docs, exampledocs/newly-created-doc.md:
---
id: newly-created-doc
title: This Doc Needs To Be Edited
---
My new content here..
- Refer to that doc's ID in an existing sidebar in
website/sidebars.json:
// Add newly-created-doc to the Getting Started category of docs
{
"docs": {
"Getting Started": [
"quick-start",
"newly-created-doc" // new doc here
],
...
},
...
}
For more information about adding new docs, click here
Adding items to your site's top navigation bar
- Add links to docs, custom pages or external links by editing the headerLinks field of
website/siteConfig.js:
website/siteConfig.js
{
headerLinks: [
...
/* you can add docs */
{ doc: 'my-examples', label: 'Examples' },
/* you can add custom pages */
{ page: 'help', label: 'Help' },
/* you can add external links */
{ href: 'https://github.com/facebook/docusaurus', label: 'GitHub' },
...
],
...
}
For more information about the navigation bar, click here
Adding custom pages
- Docusaurus uses React components to build pages. The components are saved as .js files in
website/pages/en: - If you want your page to show up in your navigation header, you will need to update
website/siteConfig.jsto add to theheaderLinkselement:
website/siteConfig.js
{
headerLinks: [
...
{ page: 'my-new-custom-page', label: 'My New Custom Page' },
...
],
...
}
For more information about custom pages, click here.
Full Documentation
Full documentation can be found on the website.