Contributing to the Datapack Wiki is very easy. We use MDSveX to integrate markdown pages with the SvelteKit backend, so to add or edit pages you only need to know how to write Markdown, and very limited HTML knowledge.
To contribute, please fork this repo and then submit a pull request with your added changes.
Tip
If you don't understand markdown or HTML, or if you require additional support, please join our Discord and we'd be happy to help!
Before you begin developing the site, it's a good idea to set up a local dev server so you can view your changes on the site in real-time. You only need a few requirements:
- Node
- A package manager (
npm
, the default with node.js, is more than enough) - Bun (optional) - we use this to generate our search indexes, it can also be used to run the project
To install the project, first install the requirements, then, run the install command in your package manager, for this example, we will use NPM.
$ npm install
To run the dev server, run the dev
script with your package manager, then open
the URL. When you then make changes to files, they will automatically update on
the dev URL.
$ npm run dev
It's recommended before you make your pull request that you run the build
and
check
commands with your package manager. These will check for common issues
you may run into.
-
Create your page .svx file. If I want to make a page at
/wiki/command/say
, I would create the file at/src/routes/wiki/command/say/+page.svx
. **All pages should be in either thewiki
orguide
folder -
Add the page metadata by putting the following at the top of the .svx file:
--- title: Page title description: "Here is a short description!" ---
-
Import the reusable components that you want to use in your page. Put the following after the metadata:
<script lang="ts"> import { Version } from "$lib/reusables"; </script>
-
Use the rest of the file to write the page content as markdown:
# /function command This command runs any `.mcfunction` file when called. You can also pass in a NBT compound or NBT source path. :::info I am a very important piece of information. Please dont ignore me. I'm only smol. ::: :::warning The stuff in this box is probably very important. ::: :::tip You can do this really cool thing. It'll make your life a lot better! :::
Tip
You can create info, warning, or tip boxes using the following syntax:
:::info
This is an info box!
:::
:::warning
This is a warning box!
:::
:::tip
This is a tip box!
:::
Note
If you don't know where to put a page on the sidebar, then mention
that in your PR, and someone else will add it for you. The sidebar pages are
stored in /src/lib/sidebar-pages/WikiPages.svelte
.
You can add categories using the <SidebarCategory>
tag:
<SidebarCategory name="Basics" icon={IconBox}>
<SidebarPage label="Commands" icon={IconCommand} page="/commands" />
<SidebarPage label="Functions" icon={IconPennant} page="/functions" />
<SidebarPage label="Advancements" icon={IconStar} page="/advancements" />
<SidebarPage label="Recipes" icon={IconGrid} page="/recipes" />
</SidebarCategory>
Sidebar categories contain pages, but the pages don't have to be within a category.
<SidebarPage label="Page Name" icon={IconName} page="/path/to/page" />
Pages and categories can have icons. We use
tabler icons to source our icons. To add an icon,
import it in the <script>
tag at the top:
import IconHome from "~icons/tabler/home";
You can then use these icons within a SidebarCategory or SidebarPage, like so
<SidebarPage label="Commands" icon={IconCommand} page="/commands" />