mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue