Routes and Links
Understand how Mordoc turns content files into URLs and how to link between pages.
In the previous step, you created a page file:
content/en/my-first-page.mdMordoc turns that file into a page you can open in the browser:
/my-first-pageThis browser address is called a route.
Open your new page
If your local server is still running, open this address in your browser:
http://localhost:5173/my-first-pageYou should see the page you created.
How page addresses are created
Mordoc looks at the file location inside content/en/ and creates the matching page address.
Here are a few examples:
content/en/index.md -> /
content/en/my-first-page.md -> /my-first-page
content/en/guides/install.md -> /guides/install
content/en/guides/index.md -> /guidesThe index.md filename is special. It becomes the main page for its folder.
For example:
content/en/index.md -> /
content/en/guides/index.md -> /guidesYou will use this pattern often when organizing groups of pages.
Link to another page
When you link from one page to another, link to the page address, not the file name.
For example, to link to the page you created:
[Read my first page](/my-first-page)Do not write the link like this:
[Read my first page](./my-first-page.md)Readers use page addresses in the browser. Your links should use those same addresses.
Link to the homepage
The homepage is:
/Link to it like this:
[Go home](/)Keep addresses simple
Use lowercase words and hyphens in filenames.
Good examples:
getting-started.md
install-guide.md
account-settings.mdAvoid spaces and special characters in filenames.
More link options
Later, the Writing Content section will explain more link examples, including links to headings inside a page.
Later, the Languages page will explain how page addresses work when your site has more than one language.