Move a site from MkDocs or Hugo
Weir, Hlin, Skadi, angreal, plissken and Fidius moved from MkDocs Material, and Cloacina from Hugo. These steps come from those moves.
Procedure
Section titled “Procedure”-
Copy the starter into the repository, as in Start a docs site. Move the old site’s pages away first.
-
Move each page into
docs/src/content/docs/, in its Diátaxis section. Make the first# Headingthe front-mattertitle, and change links to other pages to relative routes (../page/). The mdBook converter does this for plain Markdown pages:npx --prefix docs starlight-aurora-from-mdbook <old pages> docs/src/content/docs. -
Change the markup that Starlight does not know:
MkDocs Material Starlight !!! note "Title":::note[Title](warning→caution,dangerandbug→danger,tipandsuccess→tip)??? note "Title"<details><summary>Title</summary>…</details>=== "Tab"<Tabs>and<TabItem label="Tab">(the page becomes.mdx)Mermaid in superfencesa ```mermaidblock--8<--snippetsthe content itself nav:inmkdocs.ymla sidebar written out in docs/astro.config.mjsHugo Starlight {{< ref "x" >}},relrefa relative route {{< hint >}}:::note,:::tip,:::cautionor:::danger{{< tabs >}},{{< tab >}}<Tabs>,<TabItem>(the page becomes.mdx)weightsidebar: { order }aliasesold addresses for the redirects (step 4) Cloacina converted about 1,200 shortcodes with a script: see
docs/scripts/hugo_to_starlight.pyin the Cloacina repository. -
Keep the old addresses working. MkDocs and Hugo serve each page at a folder address (
/guides/install/). For each page whose address changes, add a redirect:import pageRedirects from 'starlight-aurora/redirects';integrations: [pageRedirects({'guides/install/': 'how-to/install/','api/': 'reference/',}),starlight({ /* ... */ }),],Keys and values are addresses without the base path. After each build, it writes a page at each old address that sends the reader to the new one, with a relative target, so it works under the Pages base path. Astro’s own
redirectsoption does not add the base to the target: do not use it for this. -
If the site has API docs from plissken, follow Add the API docs from plissken.
-
Remove
mkdocs.ymlorhugo.tomland the files only they used. Move static files todocs/public/, so their addresses stay the same. -
Check the build, its links, and the theme, as in Check a site.