mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
feat(v2): add edit url in post page (#2524)
* Add edit page url in docs * feat(v2): Create EditPage component * feat(v2): Improve component * Add test * çhore(v2): update description * çhore(v2): update url * fix(v2): test * fix(v2): test * feat(v2): change the prop of EditPage component * chore(v2): Remove packages * feat(v2): Update old tests * chore(v2): fix package * fix(v2): fix editUrl * docs(v2): document editUrl * -- * -- Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
This commit is contained in:
parent
7bc7241ee4
commit
5e664a1f26
9 changed files with 72 additions and 12 deletions
|
@ -11,7 +11,7 @@ import {
|
|||
parse,
|
||||
aliasedSitePath,
|
||||
normalizeUrl,
|
||||
posixPath,
|
||||
getEditUrl,
|
||||
} from '@docusaurus/utils';
|
||||
import {LoadContext} from '@docusaurus/types';
|
||||
|
||||
|
@ -90,9 +90,7 @@ export default async function processMetadata({
|
|||
|
||||
const relativePath = path.relative(siteDir, filePath);
|
||||
|
||||
const docsEditUrl = editUrl
|
||||
? normalizeUrl([editUrl, posixPath(relativePath)])
|
||||
: undefined;
|
||||
const docsEditUrl = getEditUrl(relativePath, editUrl);
|
||||
|
||||
const {frontMatter = {}, excerpt} = parse(await fileStringPromise);
|
||||
const {sidebar_label, custom_edit_url} = frontMatter;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue