/ docs-website / docusaurus.config.js
docusaurus.config.js
1 // SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai> 2 // 3 // SPDX-License-Identifier: Apache-2.0 4 5 // @ts-check 6 7 import {themes as prismThemes} from 'prism-react-renderer'; 8 import versions from './versions.json' with { type: 'json' }; 9 10 // Only build the current version (docs/) plus the 5 most recent stable versions (e.g. 2.x) and the unstable 11 // versioned docs (e.g. 2.x-unstable; only present during the release process). 12 const MAX_STABLE_VERSIONS = 5; 13 const activeVersions = [ 14 'current', 15 ...versions.filter(v => v.endsWith('-unstable')), 16 ...versions.filter(v => !v.endsWith('-unstable')).slice(0, MAX_STABLE_VERSIONS), 17 ]; 18 19 // This runs in Node.js - Don't use client-side code here (browser APIs, JSX...) 20 21 /** @type {import('@docusaurus/types').Config} */ 22 const config = { 23 title: 'Haystack Documentation', 24 tagline: 'Haystack Docs', 25 favicon: 'img/favicon.ico', 26 27 // Set the production url of your site here 28 url: 'https://docs.haystack.deepset.ai', 29 baseUrl: '/', 30 31 onBrokenLinks: 'throw', 32 onBrokenAnchors: 'throw', 33 onDuplicateRoutes: 'throw', 34 35 future: { 36 faster: true, 37 v4: true, 38 }, 39 40 markdown: { 41 mdx1Compat: { 42 comments: true, 43 }, 44 hooks: { 45 onBrokenMarkdownLinks: 'throw', 46 }, 47 }, 48 49 i18n: { 50 defaultLocale: 'en', 51 locales: ['en'], 52 }, 53 54 headTags: [ 55 { 56 tagName: "script", 57 attributes: {}, 58 innerHTML: `(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 59 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 60 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 61 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 62 })(window,document,'script','dataLayer','GTM-WCKQG9T');`, 63 } 64 ], 65 66 presets: [ 67 [ 68 'classic', 69 /** @type {import('@docusaurus/preset-classic').Options} */ 70 ({ 71 docs: { 72 onlyIncludeVersions: activeVersions, 73 sidebarPath: './sidebars.js', 74 // Exclude internal templates from the docs build 75 exclude: ['**/_templates/**'], 76 editUrl: 77 'https://github.com/deepset-ai/haystack/tree/main/docs-website/', 78 // Use beforeDefaultRemarkPlugins to ensure our plugin runs before Webpack processes links 79 beforeDefaultRemarkPlugins: [require('./src/remark/versionedReferenceLinks')], 80 versions: { 81 current: { 82 label: '2.29-unstable', 83 path: 'next', 84 banner: 'unreleased', 85 }, 86 }, 87 lastVersion: '2.28', 88 }, 89 theme: { 90 customCss: require.resolve('./src/css/custom.css'), 91 }, 92 }), 93 ], 94 ], 95 96 plugins: [ 97 function gtmNoscriptPlugin() { 98 return { 99 name: "gtm-noscript", 100 injectHtmlTags() { 101 return { 102 preBodyHtmlTags: [ 103 `<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WCKQG9T" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>`, 104 ], 105 }; 106 }, 107 }; 108 }, 109 [ 110 '@docusaurus/plugin-ideal-image', 111 { 112 quality: 70, 113 max: 1030, 114 min: 640, 115 steps: 2, 116 disableInDev: false, 117 }, 118 ], 119 [ 120 '@docusaurus/plugin-content-docs', 121 { 122 id: 'reference', 123 onlyIncludeVersions: activeVersions, 124 path: 'reference', 125 routeBasePath: 'reference', 126 sidebarPath: './reference-sidebars.js', 127 editUrl: 'https://github.com/deepset-ai/haystack/tree/main/docs-website/', 128 // Use beforeDefaultRemarkPlugins to ensure our plugin runs before Webpack processes links 129 beforeDefaultRemarkPlugins: [require('./src/remark/versionedReferenceLinks')], 130 showLastUpdateAuthor: false, 131 showLastUpdateTime: false, 132 exclude: ['**/_templates/**'], 133 versions: { 134 current: { 135 label: '2.29-unstable', 136 path: 'next', 137 banner: 'unreleased', 138 }, 139 }, 140 lastVersion: '2.28', 141 }, 142 ], 143 [ 144 'docusaurus-plugin-generate-llms-txt', 145 { 146 // defaults to "llms.txt", but set explicitly for clarity 147 outputFile: 'llms.txt', 148 }, 149 ], 150 // Local plugin to teach Webpack how to handle `.txt` files like `llms.txt` 151 require.resolve('./plugins/txtLoaderPlugin'), 152 [ 153 '@docusaurus/plugin-client-redirects', 154 { 155 redirects: [ 156 { 157 from: '/docs', 158 to: '/docs/intro', 159 }, 160 { 161 from: '/docs/get_started', 162 to: '/docs/get-started', 163 }, 164 { 165 from: '/docs/document_store', 166 to: '/docs/document-store', 167 }, 168 { 169 from: '/docs/components_overview', 170 to: '/docs/components', 171 }, 172 { 173 from: '/docs/nodes_overview', 174 to: '/docs/components', 175 }, 176 { 177 from: '/docs/retriever', 178 to: '/docs/retrievers', 179 }, 180 { 181 from: '/docs/ranker', 182 to: '/docs/rankers', 183 }, 184 { 185 from: '/docs/pipeline', 186 to: '/docs/pipelines', 187 }, 188 { 189 from: '/docs/prompt_node', 190 to: '/docs/promptbuilder', 191 }, 192 { 193 from: '/docs/join_documents', 194 to: '/docs/documentjoiner', 195 }, 196 { 197 from: '/docs/dynamicchatpromptbuilder', 198 to: '/docs/chatpromptbuilder', 199 }, 200 { 201 from: '/docs/dynamicpromptbuilder', 202 to: '/docs/promptbuilder', 203 }, 204 ], 205 }, 206 ], 207 ], 208 209 themeConfig: 210 /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ 211 ({ 212 image: 'img/haystack-ogimage.png', 213 docs: { 214 sidebar: { 215 autoCollapseCategories: true, 216 }, 217 }, 218 navbar: { 219 title: 'Haystack Documentation', 220 logo: { 221 alt: 'Haystack Logo', 222 src: 'img/logo.svg', 223 }, 224 items: [ 225 { 226 type: 'docsVersionDropdown', 227 position: 'left', 228 dropdownActiveClassDisabled: true, 229 dropdownItemsAfter: [ 230 { 231 type: 'html', 232 value: '<hr style="margin: 0.3rem 0;">', 233 }, 234 { 235 href: '/docs/faq#where-can-i-find-tutorials-and-documentation-for-haystack-1x', 236 label: '1.x archived documentation', 237 }, 238 { 239 href: '/docs/faq#where-can-i-find-documentation-for-older-haystack-versions', 240 label: '2.x archived documentation', 241 }, 242 ], 243 }, 244 { 245 type: 'doc', 246 docId: 'intro', 247 label: 'Docs', 248 position: 'left', 249 }, 250 { 251 type: 'doc', 252 docsPluginId: 'reference', 253 docId: 'api-index', 254 label: 'API Reference', 255 position: 'left', 256 }, 257 { 258 href: 'https://github.com/deepset-ai/haystack/blob/main/docs-website/CONTRIBUTING.md', 259 label: 'Contribute', 260 position: 'right', 261 }, 262 { 263 href: 'https://github.com/deepset-ai/haystack/tree/main/docs-website', 264 label: 'GitHub', 265 position: 'right', 266 }, 267 ], 268 }, 269 footer: { 270 style: 'dark', 271 links: [ 272 { 273 title: 'Community', 274 items: [ 275 { 276 html: '<div class="footer-social-icons-container"><div class="footer-social-row"><a href="https://discord.com/invite/haystack" target="_blank" rel="noopener noreferrer" class="footer__link-item" aria-label="Discord"><img src="/img/discord.svg" alt="Discord" class="footer-social-icon" /></a><a href="https://github.com/deepset-ai/haystack" target="_blank" rel="noopener noreferrer" class="footer__link-item" aria-label="GitHub"><img src="/img/github.svg" alt="GitHub" class="footer-social-icon" /></a><a href="https://x.com/haystack_ai" target="_blank" rel="noopener noreferrer" class="footer__link-item" aria-label="X"><img src="/img/x.svg" alt="X" class="footer-social-icon" /></a></div><div class="footer-social-row"><a href="https://www.linkedin.com/company/deepset-ai/" target="_blank" rel="noopener noreferrer" class="footer__link-item" aria-label="LinkedIn"><img src="/img/linkedin.svg" alt="LinkedIn" class="footer-social-icon" /></a><a href="https://www.youtube.com/channel/UC5dfn9m310oyt-cbeegfvZw" target="_blank" rel="noopener noreferrer" class="footer__link-item" aria-label="YouTube"><img src="/img/youtube.svg" alt="YouTube" class="footer-social-icon" /></a></div></div>' 277 }, 278 ], 279 }, 280 { 281 title: 'Learn', 282 items: [ 283 { label: 'Tutorials', href: 'https://haystack.deepset.ai/tutorials' }, 284 { label: 'Cookbooks', href: 'https://haystack.deepset.ai/cookbook' }, 285 ], 286 }, 287 { 288 title: 'More', 289 items: [ 290 { label: 'Integrations', href: 'https://haystack.deepset.ai/integrations' }, 291 { label: 'Platform - Try Free', href: 'https://landing.deepset.ai/deepset-studio-signup' }, 292 { label: 'Enterprise Support', href: 'https://landing.deepset.ai/deepset-studio-signup' }, 293 ], 294 }, 295 { 296 title: 'Company', 297 items: [ 298 { label: 'About', href: 'https://deepset.ai/about' }, 299 { label: 'Careers', href: 'https://deepset.ai/careers' }, 300 { label: 'Blog', href: 'https://deepset.ai/blog' }, 301 ], 302 }, 303 { 304 title: 'Legal', 305 items: [ 306 { label: 'Privacy Policy', href: 'https://www.deepset.ai/privacy-policy' }, 307 { label: 'Imprint', href: 'https://www.deepset.ai/imprint' }, 308 ], 309 }, 310 ], 311 copyright: `© ${new Date().getFullYear()} deepset GmbH. All rights reserved.`, 312 }, 313 prism: { 314 theme: prismThemes.github, 315 darkTheme: prismThemes.dracula, 316 additionalLanguages: ['python', 'bash', 'docker'], 317 }, 318 }), 319 }; 320 321 export default config;