Quickstart¶
This walk-through builds a small MkDocs site with prefixed filenames and checks that the output URLs are clean.
Prerequisites¶
- The plugin and MkDocs are installed in the same environment. See Installation.
- An empty working folder.
Steps¶
-
Create the source folder and three pages:
mkdir -p docs/030--guides printf '# Home\n\nRead the [introduction](010--introduction.md).\n' > docs/index.md printf '# Introduction\n\nNext: [setup](030--guides/010--setup.md).\n' > docs/010--introduction.md printf '# Setup\n\nBack to the [introduction](../010--introduction.md).\n' > docs/030--guides/010--setup.md -
Create
mkdocs.ymlnext to thedocsfolder:Listing
strip-number-prefixwithout options uses the defaults:pattern: '^\d+--',strict: true,strip_links: false,strip_nav_titles: true,verbose: false,dry_run: false. -
Build the site:
The build finishes without warnings. The links in step 1 point at the prefixed source files, and MkDocs resolves them to the clean URLs.
-
List the generated pages:
Result:
No
010--or030--appears in the output paths. -
Look at a link in the home page:
The link written as
010--introduction.mdwas rendered asintroduction/.
What happened¶
- MkDocs collected
index.md,010--introduction.mdand030--guides/010--setup.mdfromdocs/. - In its
on_filesstep, the plugin removed010--and030--from each path component and set the newdest_pathandurlof each file. - MkDocs converted each Markdown link that names a source file into the URL of that file, so the links follow the clean URLs automatically.
- In the navigation, the folder
030--guidesbecame the sectionguides.
Next steps¶
- Change the prefix format or turn on collision warnings: Configuration.
- Learn the link rules: Links and navigation.