mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-12 08:37:25 +02:00
fix: docs asset links should follow specified docsUrl (#1204)
This commit is contained in:
parent
1888e0fb92
commit
487fd573e5
2 changed files with 5 additions and 2 deletions
|
@ -111,7 +111,10 @@ function getMarkup(rawContent, mdToHtml, metadata) {
|
||||||
content = mdToHtmlify(content, mdToHtml, metadata);
|
content = mdToHtmlify(content, mdToHtml, metadata);
|
||||||
|
|
||||||
// replace any relative links to static assets (not in fenced code blocks) to absolute links
|
// replace any relative links to static assets (not in fenced code blocks) to absolute links
|
||||||
content = replaceAssetsLink(content, `${siteConfig.baseUrl}docs`);
|
const docsAssetsLocation = siteConfig.docsUrl
|
||||||
|
? `${siteConfig.baseUrl}${siteConfig.docsUrl}`
|
||||||
|
: siteConfig.baseUrl.substring(0, siteConfig.baseUrl.length - 1);
|
||||||
|
content = replaceAssetsLink(content, docsAssetsLocation);
|
||||||
|
|
||||||
const DocsLayout = require('../core/DocsLayout.js');
|
const DocsLayout = require('../core/DocsLayout.js');
|
||||||
return renderToStaticMarkupWithDoctype(
|
return renderToStaticMarkupWithDoctype(
|
||||||
|
|
|
@ -101,7 +101,7 @@ async function execute() {
|
||||||
if (fs.existsSync(join(CWD, '..', readMetadata.getDocsPath(), 'assets'))) {
|
if (fs.existsSync(join(CWD, '..', readMetadata.getDocsPath(), 'assets'))) {
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
join(CWD, '..', readMetadata.getDocsPath(), 'assets'),
|
join(CWD, '..', readMetadata.getDocsPath(), 'assets'),
|
||||||
join(buildDir, 'docs', 'assets'),
|
join(buildDir, siteConfig.docsUrl, 'assets'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue