Skip to content

Commit

Permalink
fix: docs asset links should follow specified docsUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinchin committed Jan 27, 2019
1 parent cbcbf5a commit 4d7847c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion v1/lib/server/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ function getMarkup(rawContent, mdToHtml, metadata) {
content = mdToHtmlify(content, mdToHtml, metadata);

// 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');
return renderToStaticMarkupWithDoctype(
Expand Down
2 changes: 1 addition & 1 deletion v1/lib/server/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function execute() {
if (fs.existsSync(join(CWD, '..', readMetadata.getDocsPath(), 'assets'))) {
fs.copySync(
join(CWD, '..', readMetadata.getDocsPath(), 'assets'),
join(buildDir, 'docs', 'assets'),
join(buildDir, siteConfig.docsUrl, 'assets'),
);
}

Expand Down

0 comments on commit 4d7847c

Please sign in to comment.