docusaurus/website/versioned_docs/version-2.0.0-beta.14/advanced/routing.md
Joshua Chen 59022c5eea
docs: add advanced guides (#6296)
* docs: add advanced guides

* complete

* fix link

* Create architecture

* use png

* explanations

* more text

* process.env.NODE_ENV

* typo

* Add image zoom

* nit

* nit

* reorganize

* fix links

* fix links

* reorganize

* elaborate on presets

* fix

* routing docs

* ssr section

* more content

* complete SSR guide

* pathname://

* improvements

* document executionenvironment

* reformat

* final tweaks!

* avoid slug

* oops
2022-01-25 11:29:18 +08:00

17 lines
707 B
Markdown

# Routing
This page is only accessible through version-switching. It shows how a versioned doc file becomes a webpage.
```mdx-code-block
import {useLatestVersion, useActiveDocContext} from '@docusaurus/plugin-content-docs/client';
import {useLocation} from '@docusaurus/router';
export const URLPath = () => <code>{useLocation().pathname}</code>;
export const FilePath = () => {
const currentVersion = useActiveDocContext('default').activeVersion.name;
return <code>{currentVersion === 'current' ? './docs/' : `./versioned_docs/version-${currentVersion}/`}advanced/routing.md</code>;
}
```
This page, <URLPath />, is generated from the file at <FilePath />. The component used is `@theme/DocItem`.