mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 16:47:26 +02:00
breaking(v2): editUrl should point to website instead of docsDir to support editUrl in versioning/trans (#1958)
This commit is contained in:
parent
1235fc9f7e
commit
6a3efd5f3d
5 changed files with 13 additions and 8 deletions
|
@ -80,7 +80,7 @@ describe('processMetadata', () => {
|
|||
|
||||
test('docs with editUrl', async () => {
|
||||
const editUrl =
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/';
|
||||
'https://github.com/facebook/docusaurus/edit/master/website';
|
||||
const source = path.join('foo', 'baz.md');
|
||||
const data = await processMetadata({
|
||||
source,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {parse, normalizeUrl} from '@docusaurus/utils';
|
||||
import {parse, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import {DocusaurusConfig} from '@docusaurus/types';
|
||||
|
||||
import lastUpdate from './lastUpdate';
|
||||
|
@ -100,7 +100,10 @@ export default async function processMetadata({
|
|||
}
|
||||
|
||||
if (editUrl) {
|
||||
metadata.editUrl = normalizeUrl([editUrl, source]);
|
||||
metadata.editUrl = normalizeUrl([
|
||||
editUrl,
|
||||
posixPath(path.relative(siteDir, filePath)),
|
||||
]);
|
||||
}
|
||||
|
||||
if (metadata.custom_edit_url) {
|
||||
|
|
|
@ -131,9 +131,9 @@ module.exports = {
|
|||
*/
|
||||
path: 'docs',
|
||||
/**
|
||||
* URL for editing docs, example: 'https://github.com/facebook/docusaurus/edit/master/website/docs/'
|
||||
* URL for editing website repo, example: 'https://github.com/facebook/docusaurus/edit/master/website/'
|
||||
*/
|
||||
editUrl: 'https://github.com/repo/project/website/docs/',
|
||||
editUrl: 'https://github.com/repo/project/website/',
|
||||
/**
|
||||
* URL route for the blog section of your site
|
||||
* do not include trailing slash
|
||||
|
|
|
@ -274,6 +274,8 @@ Deprecated. Create a `CNAME` file in your `static` folder instead with your cust
|
|||
|
||||
#### `customDocsPath`, `docsUrl`, `editUrl`, `enableUpdateBy`, `enableUpdateTime`
|
||||
|
||||
**BREAKING**: `editUrl` should point to (website) docusaurus project instead of `docs` directory.
|
||||
|
||||
Deprecated. Pass it as an option to `@docusaurus/preset-classic` docs instead:
|
||||
|
||||
```jsx {9-22}
|
||||
|
@ -287,9 +289,9 @@ module.exports = {
|
|||
docs: {
|
||||
// Equivalent to `customDocsPath`.
|
||||
path: 'docs',
|
||||
// Equivalent to `editUrl`
|
||||
// Equivalent to `editUrl` but should point to `website` dir instead of `website/docs`
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/',
|
||||
'https://github.com/facebook/docusaurus/edit/master/website',
|
||||
// Equivalent to `docsUrl`.
|
||||
routeBasePath: 'docs',
|
||||
// Remark and Rehype plugins passed to MDX. Replaces `markdownOptions` and `markdownPlugins`.
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = {
|
|||
path: 'docs',
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
editUrl:
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/docs/',
|
||||
'https://github.com/facebook/docusaurus/edit/master/website/',
|
||||
showLastUpdateAuthor: true,
|
||||
showLastUpdateTime: true,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue