Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

docs: fix docs build

Martin Adámek793eb60433d7
diff --git a/packages/core/src/session_pool/session_pool.ts b/packages/core/src/session_pool/session_pool.ts
index 6c831e080..8b86ab2b0 100644
--- a/packages/core/src/session_pool/session_pool.ts
+++ b/packages/core/src/session_pool/session_pool.ts
@@ -62,7 +62,7 @@ export interface SessionPoolOptions {
* Handles the rotation, creation and persistence of user-like sessions.
* Creates a pool of {@apilink Session} instances, that are randomly rotated.
* When some session is marked as blocked, it is removed and new one is created instead (the pool never returns an unusable session).
- * Learn more in the [Session management guide](../../../docs/guides/session-management).
+ * Learn more in the {@doclink guides/session-management | Session management guide}.
*
* You can create one by calling the {@apilink SessionPool.open} function.
*
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index c9b7cfe20..9547f362a 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -1,9 +1,5 @@
/* eslint-disable global-require,import/no-extraneous-dependencies */
const { externalLinkProcessor } = require('./tools/utils/externalLink');
-const pkg = require('../packages/crawlee/package.json');
-
-const [v1, v2] = pkg.version.split('.');
-const version = [v1, v2].join('.');
const packages = [
'core',
diff --git a/website/src/components/ApiLink.jsx b/website/src/components/ApiLink.jsx
index f7ff8f837..8bee3761d 100644
--- a/website/src/components/ApiLink.jsx
+++ b/website/src/components/ApiLink.jsx
@@ -4,11 +4,16 @@ import Link from '@docusaurus/Link';
import { useDocsVersion } from '@docusaurus/theme-common/internal';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
+const pkg = require('../../../packages/crawlee/package.json');
+
+const [v1, v2] = pkg.version.split('.');
+const stable = [v1, v2].join('.');
+
const ApiLink = ({ to, children }) => {
const version = useDocsVersion();
const { siteConfig } = useDocusaurusContext();
- if (siteConfig.presets[0][1].docs.disableVersioning) {
+ if (siteConfig.presets[0][1].docs.disableVersioning || version.version === stable) {
return (
<Link to={`/api/${to}`}>{children}</Link>
);
diff --git a/website/static/js/custom.js b/website/static/js/custom.js
index 08dac9c8d..19c7f3aa6 100644
--- a/website/static/js/custom.js
+++ b/website/static/js/custom.js
@@ -6,14 +6,14 @@ function load() {
for (const el of versions) {
const match = el.href.match(/\/docs\/(\d+\.\d+(\.\d+)?)$/) || el.href.match(/\/docs\/(\d+\.\d+(\.\d+)?)/);
- const version = (types[i++] || match[0]).replace('/docs', '/api');
+ const version = (types[i++] || match[0] || '').replace('/docs', '/api');
if (el.classList.contains('api-version-bound')) {
continue;
}
el.addEventListener('click', (e) => {
- if (window.location.pathname.startsWith(`${basePath}/api`)) {
+ if (version && window.location.pathname.startsWith(`${basePath}/api`)) {
window.location.href = version;
e.preventDefault();
}