From bf5557987a71a2e7431c3d83a9c5a54a2e8f5ff3 Mon Sep 17 00:00:00 2001 From: HonzaTuron Date: Wed, 13 Aug 2025 14:17:48 +0200 Subject: [PATCH 1/4] feat: Improve llms.txt --- apify-docs-theme/src/theme/Layout/index.jsx | 2 +- package-lock.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apify-docs-theme/src/theme/Layout/index.jsx b/apify-docs-theme/src/theme/Layout/index.jsx index 2ca67c8a9..5f88f55ae 100644 --- a/apify-docs-theme/src/theme/Layout/index.jsx +++ b/apify-docs-theme/src/theme/Layout/index.jsx @@ -14,7 +14,7 @@ export default function LayoutWrapper(props) { return ( <> - +
Date: Wed, 13 Aug 2025 14:27:35 +0200 Subject: [PATCH 2/4] feat: Add site config url --- apify-docs-theme/src/theme/Layout/index.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apify-docs-theme/src/theme/Layout/index.jsx b/apify-docs-theme/src/theme/Layout/index.jsx index 5f88f55ae..58034bb52 100644 --- a/apify-docs-theme/src/theme/Layout/index.jsx +++ b/apify-docs-theme/src/theme/Layout/index.jsx @@ -3,10 +3,12 @@ import { useLocation } from '@docusaurus/router'; // cannot use any of the theme aliases here as it causes a circular dependency :( ideas welcome import Layout from '@docusaurus/theme-classic/lib/theme/Layout/index'; import useBaseUrl from '@docusaurus/useBaseUrl'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import { usePluginData } from '@docusaurus/useGlobalData'; import React from 'react'; export default function LayoutWrapper(props) { + const { siteConfig } = useDocusaurusContext(); const { options: { subNavbar } } = usePluginData('@apify/docs-theme'); const baseUrl = useBaseUrl('/'); const currentPath = useLocation().pathname.replace(new RegExp(`^${baseUrl}`), ''); @@ -14,7 +16,7 @@ export default function LayoutWrapper(props) { return ( <> - +
Date: Wed, 13 Aug 2025 15:37:16 +0200 Subject: [PATCH 3/4] feat: Fix markdown alternate & add absolute links --- apify-docs-theme/src/theme/Layout/index.jsx | 2 +- docusaurus.config.js | 15 ++++++++++++--- tools/utils/externalLink.js | 6 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apify-docs-theme/src/theme/Layout/index.jsx b/apify-docs-theme/src/theme/Layout/index.jsx index 58034bb52..389297ebc 100644 --- a/apify-docs-theme/src/theme/Layout/index.jsx +++ b/apify-docs-theme/src/theme/Layout/index.jsx @@ -16,7 +16,7 @@ export default function LayoutWrapper(props) { return ( <> - + {currentPath && }
} */ module.exports = { @@ -264,7 +264,8 @@ module.exports = { }), [ '@signalwire/docusaurus-plugin-llms-txt', - { + /** @type {import('@signalwire/docusaurus-plugin-llms-txt').PluginOptions} */ + ({ content: { includeVersionedDocs: false, enableLlmsFullTxt: true, @@ -272,6 +273,14 @@ module.exports = { includeGeneratedIndex: false, includePages: true, relativePaths: false, + remarkStringify: { + handlers: { + link: (node) => { + const isUrlInternal = isInternal(node.url); + return `[${node.title}](${isUrlInternal ? `${config.absoluteUrl}${node.url}` : node.url})`; + }, + }, + }, excludeRoutes: [ '/', ], @@ -294,7 +303,7 @@ module.exports = { }, ], }, - }, + }), ], // TODO this should be somehow computed from all the external sources // [ diff --git a/tools/utils/externalLink.js b/tools/utils/externalLink.js index b94fc8aff..774c4bf03 100644 --- a/tools/utils/externalLink.js +++ b/tools/utils/externalLink.js @@ -7,12 +7,12 @@ const internalUrls = ['sdk.apify.com']; /** * @param {import('url').UrlWithStringQuery} href */ -function isInternal(href) { +exports.isInternal = (href) => { return internalUrls.some( (internalUrl) => href.host === internalUrl || (!href.protocol && !href.host && (href.pathname || href.hash)), ); -} +}; /** * @type {import('unified').Plugin} @@ -27,7 +27,7 @@ exports.externalLinkProcessor = () => { ) { const href = parse(node.properties.href); - if (!isInternal(href)) { + if (!exports.isInternal(href)) { node.properties.target = '_blank'; node.properties.rel = 'noopener'; } else { From 21dde06994855ff252476e9a580abd36adbad896 Mon Sep 17 00:00:00 2001 From: HonzaTuron Date: Mon, 18 Aug 2025 16:06:49 +0200 Subject: [PATCH 4/4] feat: Markdown URLs --- docusaurus.config.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docusaurus.config.js b/docusaurus.config.js index 10987273d..4fb4d2a47 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -277,7 +277,10 @@ module.exports = { handlers: { link: (node) => { const isUrlInternal = isInternal(node.url); - return `[${node.title}](${isUrlInternal ? `${config.absoluteUrl}${node.url}` : node.url})`; + const url = isUrlInternal ? `${config.absoluteUrl}${node.url}` : node.url; + + if (node.title) return `[${node.title}](${url})`; + return url; }, }, },