Skip to content

Commit f9e2026

Browse files
committed
feat: Add absolute url
1 parent 760331e commit f9e2026

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ module.exports = {
296296
if (node.title?.startsWith('Direct link to')) return '';
297297

298298
const parsedUrl = parse(node.url);
299-
const isUrlInternal = isInternal(parsedUrl);
299+
const isUrlInternal = isInternal(parsedUrl, config.absoluteUrl);
300300
const url = isUrlInternal ? `${config.absoluteUrl}${parsedUrl.pathname}.md` : node.url;
301301

302302
if (isUrlInternal && !parsedUrl.pathname) return '';

tools/utils/externalLink.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const internalUrl = 'docs.apify.com';
77
/**
88
* @param {import('url').UrlWithStringQuery} href
99
*/
10-
exports.isInternal = (href) => {
11-
return href.host === internalUrl || (!href.protocol && !href.host && (href.pathname || href.hash));
10+
exports.isInternal = (href, hostName) => {
11+
return href.host === hostName || (!href.protocol && !href.host && (href.pathname || href.hash));
1212
};
1313

1414
/**
@@ -24,7 +24,7 @@ exports.externalLinkProcessor = () => {
2424
) {
2525
const href = parse(node.properties.href);
2626

27-
if (!exports.isInternal(href)) {
27+
if (!exports.isInternal(href, internalUrl)) {
2828
node.properties.target = '_blank';
2929
node.properties.rel = 'noopener';
3030
} else {

0 commit comments

Comments
 (0)