mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 13:17:23 +02:00
* 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
17 lines
707 B
Markdown
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`.
|