mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 00:27:21 +02:00
perf(v2): smaller bundlesize by embedding metadata to content (#2088)
* wip embed metadata to content * embed metadata in blog as well * refactor * update test * yarn lock * avoid overwriting file everytime we run new nodejs process * nits
This commit is contained in:
parent
32c9d07b90
commit
7f8aca2ddc
16 changed files with 236 additions and 200 deletions
|
@ -7,7 +7,12 @@
|
|||
|
||||
import fs from 'fs-extra';
|
||||
import path from 'path';
|
||||
import {parse, normalizeUrl, posixPath} from '@docusaurus/utils';
|
||||
import {
|
||||
parse,
|
||||
aliasedSitePath,
|
||||
normalizeUrl,
|
||||
posixPath,
|
||||
} from '@docusaurus/utils';
|
||||
import {LoadContext} from '@docusaurus/types';
|
||||
|
||||
import lastUpdate from './lastUpdate';
|
||||
|
@ -84,9 +89,6 @@ export default async function processMetadata({
|
|||
|
||||
const relativePath = path.relative(siteDir, filePath);
|
||||
|
||||
// Cannot use path.join() as it resolves '../' and removes the '@site'. Let webpack loader resolve it.
|
||||
const aliasedPath = `@site/${relativePath}`;
|
||||
|
||||
const docsEditUrl = editUrl
|
||||
? normalizeUrl([editUrl, posixPath(relativePath)])
|
||||
: undefined;
|
||||
|
@ -130,7 +132,7 @@ export default async function processMetadata({
|
|||
id,
|
||||
title,
|
||||
description,
|
||||
source: aliasedPath,
|
||||
source: aliasedSitePath(filePath, siteDir),
|
||||
permalink,
|
||||
editUrl: custom_edit_url || docsEditUrl,
|
||||
version,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue