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: try to fix active class on navbar api docs links

Martin Adámek4d598d2330d7
diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js
index 1ee48c0d6..51fee3ad3 100644
--- a/website/docusaurus.config.js
+++ b/website/docusaurus.config.js
@@ -156,6 +156,7 @@ module.exports = {
to: 'core',
label: 'API',
position: 'left',
+ activeBaseRegex: 'api/(?!.*/changelog)',
},
{
type: 'custom-api',
@@ -163,6 +164,7 @@ module.exports = {
label: 'Changelog',
position: 'left',
className: 'changelog',
+ activeBaseRegex: 'changelog',
},
{
type: 'docsVersionDropdown',
diff --git a/website/src/theme/NavbarItem/ComponentTypes.js b/website/src/theme/NavbarItem/ComponentTypes.js
index d871a4b22..97a034c26 100644
--- a/website/src/theme/NavbarItem/ComponentTypes.js
+++ b/website/src/theme/NavbarItem/ComponentTypes.js
@@ -39,7 +39,6 @@ function DocNavbarItem({
}
function ApiNavbarItem(ctx) {
- const { activeDoc, activeVersion } = useActiveDocContext();
let version = {};
try {
@@ -56,8 +55,7 @@ function ApiNavbarItem(ctx) {
<DefaultNavbarItem
exact
{...ctx}
- isActive={() => activeDoc?.path.startsWith(activeVersion?.path.replace(/^\/docs/, '/api'))}
- label={ctx.staticLabel ?? ctx.label}
+ label={ctx.label}
to={`api/${ctx.to}`}
/>
);
@@ -67,8 +65,7 @@ function ApiNavbarItem(ctx) {
<DefaultNavbarItem
exact
{...ctx}
- isActive={() => activeDoc?.path.startsWith(activeVersion?.path.replace(/^\/docs/, '/api'))}
- label={ctx.staticLabel ?? ctx.label}
+ label={ctx.label}
to={`api/${version.version === 'current' ? 'next' : version.version}/${ctx.to}`}
/>
);