Skip to content

Commit fd5936a

Browse files
committed
node startswith
1 parent 15bfbbf commit fd5936a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

docusaurus.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ module.exports = {
293293
remarkStringify: {
294294
handlers: {
295295
link: (node) => {
296-
const isUrlInternal = isInternal(parse(node.url));
296+
if (node.title?.startsWith('Direct link to')) return null;
297+
298+
const parsedUrl = parse(node.url);
299+
const isUrlInternal = isInternal(parsedUrl);
297300
const url = isUrlInternal ? `${config.absoluteUrl}${node.url}.md` : node.url;
298301

299302
if (node.title) return `[${node.title}](${url})`;

tools/utils/externalLink.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@ const { parse } = require('node:url');
22

33
const visit = import('unist-util-visit').then((m) => m.visit);
44

5-
const internalUrls = ['docs.apify.com'];
5+
const internalUrl = 'docs.apify.com';
66

77
/**
88
* @param {import('url').UrlWithStringQuery} href
99
*/
1010
exports.isInternal = (href) => {
11-
return internalUrls.some(
12-
(internalUrl) => href.host === internalUrl
13-
|| (!href.protocol && !href.host && (href.pathname || href.hash)),
14-
);
11+
return href.host === internalUrl || (!href.protocol && !href.host && (href.pathname || href.hash));
1512
};
1613

1714
/**

0 commit comments

Comments
 (0)