mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-14 01:27:35 +02:00
fix: do not hardcode siteConfig path (#1150)
* Fix broken build Do not hardcode path in require to siteConfig * Just require instead of loadConfig * Actually use loadConfig I think the test may be wrong too. * refactor & nits * jest mock to fix test * fix test
This commit is contained in:
parent
71824a3541
commit
c78a8b4262
5 changed files with 19 additions and 11 deletions
|
@ -4,12 +4,16 @@
|
|||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
const CWD = process.cwd();
|
||||
const React = require('react');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const metadataUtils = require('./metadataUtils');
|
||||
const {replaceAssetsLink} = require('./utils.js');
|
||||
const {renderToStaticMarkupWithDoctype} = require('./renderUtils');
|
||||
const loadConfig = require('./config');
|
||||
|
||||
const siteConfig = loadConfig(`${CWD}/siteConfig.js`);
|
||||
|
||||
function urlToSource(url) {
|
||||
if (!url || typeof url !== 'string') {
|
||||
|
@ -59,7 +63,10 @@ function getMetadata(file) {
|
|||
const metadata = Object.assign(
|
||||
{
|
||||
path: fileToUrl(file),
|
||||
content: replaceAssetsLink(result.rawContent, 'blog'),
|
||||
content: replaceAssetsLink(
|
||||
result.rawContent,
|
||||
`${siteConfig.baseUrl}blog`,
|
||||
),
|
||||
},
|
||||
result.metadata,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue