blob: 8a3a888090a95af54146a8413ec7275f3a367b5f [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import type { Config } from '@docusaurus/types';
import type { Options, ThemeConfig } from '@docusaurus/preset-classic';
import { themes } from 'prism-react-renderer';
import remarkImportPartial from 'remark-import-partial';
import * as fs from 'fs';
import * as path from 'path';
const { github: lightCodeTheme, vsDark: darkCodeTheme } = themes;
// Load version configuration from external file
const versionsConfigPath = path.join(__dirname, 'versions-config.json');
const versionsConfig = JSON.parse(fs.readFileSync(versionsConfigPath, 'utf8'));
// Build plugins array dynamically based on disabled flags
const dynamicPlugins = [];
// Add components plugin if not disabled
if (!versionsConfig.components.disabled) {
dynamicPlugins.push([
'@docusaurus/plugin-content-docs',
{
id: 'components',
path: 'components',
routeBasePath: 'components',
sidebarPath: require.resolve('./sidebarComponents.js'),
editUrl:
'https://github.com/apache/superset/edit/master/docs/components',
remarkPlugins: [remarkImportPartial],
docItemComponent: '@theme/DocItem',
includeCurrentVersion: versionsConfig.components.includeCurrentVersion,
lastVersion: versionsConfig.components.lastVersion,
onlyIncludeVersions: versionsConfig.components.onlyIncludeVersions,
versions: versionsConfig.components.versions,
disableVersioning: false,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
]);
}
// Add developer_portal plugin if not disabled
if (!versionsConfig.developer_portal.disabled) {
dynamicPlugins.push([
'@docusaurus/plugin-content-docs',
{
id: 'developer_portal',
path: 'developer_portal',
routeBasePath: 'developer_portal',
sidebarPath: require.resolve('./sidebarTutorials.js'),
editUrl:
'https://github.com/apache/superset/edit/master/docs/developer_portal',
remarkPlugins: [remarkImportPartial],
docItemComponent: '@theme/DocItem',
includeCurrentVersion: versionsConfig.developer_portal.includeCurrentVersion,
lastVersion: versionsConfig.developer_portal.lastVersion,
onlyIncludeVersions: versionsConfig.developer_portal.onlyIncludeVersions,
versions: versionsConfig.developer_portal.versions,
disableVersioning: false,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
]);
}
// Build navbar items dynamically based on disabled flags
const dynamicNavbarItems = [];
// Add Component Playground navbar item if not disabled
if (!versionsConfig.components.disabled) {
dynamicNavbarItems.push({
label: 'Component Playground',
to: '/components',
items: [
{
label: 'Introduction',
to: '/components',
},
{
label: 'UI Components',
to: '/components/ui-components/button',
},
{
label: 'Chart Components',
to: '/components/chart-components/bar-chart',
},
{
label: 'Layout Components',
to: '/components/layout-components/grid',
},
],
});
}
// Add Developer Portal navbar item if not disabled
if (!versionsConfig.developer_portal.disabled) {
dynamicNavbarItems.push({
label: 'Developer Portal',
position: 'left',
items: [
{
type: 'doc',
docsPluginId: 'developer_portal',
docId: 'index',
label: 'Introduction',
},
{
type: 'doc',
docsPluginId: 'developer_portal',
docId: 'getting-started/index',
label: 'Getting Started',
},
],
});
}
const config: Config = {
title: 'Superset',
tagline:
'Apache Superset is a modern data exploration and visualization platform',
url: 'https://superset.apache.org',
baseUrl: '/',
onBrokenLinks: 'warn',
onBrokenMarkdownLinks: 'throw',
markdown: {
mermaid: true,
},
favicon: '/img/favicon.ico',
organizationName: 'apache',
projectName: 'superset',
themes: ['@saucelabs/theme-github-codeblock', '@docusaurus/theme-mermaid'],
plugins: [
require.resolve('./src/webpack.extend.ts'),
[
'docusaurus-plugin-less',
{
lessOptions: {
javascriptEnabled: true,
},
},
],
...dynamicPlugins,
[
'@docusaurus/plugin-client-redirects',
{
redirects: [
{
to: '/docs/installation/docker-compose',
from: '/installation.html',
},
{
to: '/docs/intro',
from: '/tutorials.html',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/admintutorial.html',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/usertutorial.html',
},
{
to: '/docs/security/',
from: '/security.html',
},
{
to: '/docs/configuration/sql-templating',
from: '/sqllab.html',
},
{
to: '/docs/intro',
from: '/gallery.html',
},
{
to: '/docs/configuration/databases',
from: '/druid.html',
},
{
to: '/docs/configuration/country-map-tools',
from: '/misc.html',
},
{
to: '/docs/configuration/country-map-tools',
from: '/visualization.html',
},
{
to: '/docs/faq',
from: '/videos.html',
},
{
to: '/docs/faq',
from: '/faq.html',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/tutorial.html',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/docs/creating-charts-dashboards/first-dashboard',
},
{
to: '/docs/api',
from: '/docs/rest-api',
},
{
to: '/docs/configuration/alerts-reports',
from: '/docs/installation/alerts-reports',
},
{
to: '/docs/contributing/development',
from: '/docs/contributing/hooks-and-linting',
},
{
to: '/docs/intro',
from: '/docs/roadmap',
},
{
to: '/docs/contributing/',
from: '/docs/contributing/contribution-guidelines',
},
{
to: '/docs/contributing/',
from: '/docs/contributing/contribution-page',
},
{
to: '/docs/configuration/databases',
from: '/docs/databases/yugabyte/',
},
{
to: '/docs/faq',
from: '/docs/frequently-asked-questions',
},
{
to: '/docs/installation/kubernetes',
from: '/docs/installation/running-on-kubernetes/',
},
{
to: '/docs/contributing/howtos',
from: '/docs/contributing/testing-locally/',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/docs/creating-charts-dashboards/creating-your-first-dashboard/',
},
{
to: '/docs/using-superset/creating-your-first-dashboard',
from: '/docs/creating-charts-dashboards/exploring-data/',
},
{
to: '/docs/installation/docker-compose',
from: '/docs/installation/installing-superset-using-docker-compose/',
},
{
to: '/docs/contributing/howtos',
from: '/docs/contributing/creating-viz-plugins/',
},
{
to: '/docs/installation/kubernetes',
from: '/docs/installation/',
},
{
to: '/docs/installation/pypi',
from: '/docs/installation/installing-superset-from-pypi/',
},
{
to: '/docs/configuration/configuring-superset',
from: '/docs/installation/configuring-superset/',
},
{
to: '/docs/configuration/cache',
from: '/docs/installation/cache/',
},
{
to: '/docs/configuration/async-queries-celery',
from: '/docs/installation/async-queries-celery/',
},
{
to: '/docs/configuration/event-logging',
from: '/docs/installation/event-logging/',
},
{
to: '/docs/contributing/howtos',
from: '/docs/contributing/translations/',
},
],
},
],
],
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({ versionDocsDirPath, docPath }) => {
if (docPath === 'intro.md') {
return 'https://github.com/apache/superset/edit/master/README.md';
}
return `https://github.com/apache/superset/edit/master/docs/${versionDocsDirPath}/${docPath}`;
},
includeCurrentVersion: versionsConfig.docs.includeCurrentVersion,
lastVersion: versionsConfig.docs.lastVersion, // Make 'next' the default
onlyIncludeVersions: versionsConfig.docs.onlyIncludeVersions,
versions: versionsConfig.docs.versions,
disableVersioning: false,
showLastUpdateAuthor: true,
showLastUpdateTime: true,
},
blog: {
showReadingTime: true,
// Please change this to your repo.
editUrl:
'https://github.com/facebook/docusaurus/edit/main/website/blog/',
},
theme: {
customCss: require.resolve('./src/styles/custom.css'),
},
} satisfies Options,
],
],
themeConfig: {
colorMode: {
defaultMode: 'dark',
disableSwitch: false,
respectPrefersColorScheme: true,
},
algolia: {
appId: 'WR5FASX5ED',
apiKey: 'd0d22810f2e9b614ffac3a73b26891fe',
indexName: 'superset-apache',
},
mermaid: {
theme: { light: 'neutral', dark: 'dark' },
options: {
// Any Mermaid config options go here...
maxTextSize: 100000,
},
},
navbar: {
logo: {
alt: 'Superset Logo',
src: '/img/superset-logo-horiz.svg',
srcDark: '/img/superset-logo-horiz-dark.svg',
},
items: [
{
label: 'Documentation',
position: 'left',
items: [
{
type: 'doc',
docId: 'intro',
label: 'Getting Started',
},
{
type: 'doc',
docId: 'faq',
label: 'FAQ',
},
],
},
{
label: 'Community Resources',
to: '/community',
items: [
{
label: 'Resources',
href: '/community',
},
{
label: 'GitHub',
href: 'https://github.com/apache/superset',
},
{
label: 'Slack',
href: 'http://bit.ly/join-superset-slack',
},
{
label: 'Mailing List',
href: 'https://lists.apache.org/list.html?dev@superset.apache.org',
},
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/apache-superset',
},
],
},
...dynamicNavbarItems,
{
href: '/docs/intro',
position: 'right',
className: 'default-button-theme get-started-button',
label: 'Get Started',
},
{
href: 'https://github.com/apache/superset',
position: 'right',
className: 'github-button',
},
],
},
footer: {
links: [],
copyright: `
<div class="footer__applitools">
We use &nbsp;<a href="https://applitools.com/" target="_blank" rel="nofollow"><img src="/img/applitools.png" title="Applitools" /></a>
</div>
<p>Copyright © ${new Date().getFullYear()},
The <a href="https://www.apache.org/" target="_blank" rel="noreferrer">Apache Software Foundation</a>,
Licensed under the Apache <a href="https://apache.org/licenses/LICENSE-2.0" target="_blank" rel="noreferrer">License</a>.</p>
<p><small>Apache Superset, Apache, Superset, the Superset logo, and the Apache feather logo are either registered trademarks or trademarks of The Apache Software Foundation. All other products or name brands are trademarks of their respective holders, including The Apache Software Foundation.
<a href="https://www.apache.org/" target="_blank">Apache Software Foundation</a> resources</small></p>
<img class="footer__divider" src="/img/community/line.png" alt="Divider" />
<p>
<small>
<a href="/docs/security/" target="_blank" rel="noreferrer">Security</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noreferrer">Donate</a>&nbsp;|&nbsp;
<a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noreferrer">Thanks</a>&nbsp;|&nbsp;
<a href="https://apache.org/events/current-event" target="_blank" rel="noreferrer">Events</a>&nbsp;|&nbsp;
<a href="https://apache.org/licenses/" target="_blank" rel="noreferrer">License</a>&nbsp;|&nbsp;
<a href="https://privacy.apache.org/policies/privacy-policy-public.html" target="_blank" rel="noreferrer">Privacy</a>
</small>
</p>
<!-- telemetry/analytics pixel: -->
<img referrerPolicy="no-referrer-when-downgrade" src="https://static.scarf.sh/a.png?x-pxid=39ae6855-95fc-4566-86e5-360d542b0a68" />
`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
docs: {
sidebar: {
hideable: true,
},
},
} satisfies ThemeConfig,
scripts: [
// {
// src: 'https://www.bugherd.com/sidebarv2.js?apikey=enilpiu7bgexxsnoqfjtxa',
// async: true,
// },
{
src: 'https://widget.kapa.ai/kapa-widget.bundle.js',
async: true,
'data-website-id': 'c6a8a8b8-3127-48f9-97a7-51e9e10d20d0',
'data-project-name': 'Apache Superset',
'data-project-color': '#FFFFFF',
'data-project-logo':
'https://images.seeklogo.com/logo-png/50/2/superset-icon-logo-png_seeklogo-500354.png',
'data-modal-override-open-id': 'ask-ai-input',
'data-modal-override-open-class': 'search-input',
'data-modal-disclaimer':
'This is a custom LLM for Apache Superset with access to all [documentation](superset.apache.org/docs/intro/), [GitHub Open Issues, PRs and READMEs](github.com/apache/superset).&#10;&#10;Companies deploy assistants like this ([built by kapa.ai](https://kapa.ai)) on docs via [website widget](https://docs.kapa.ai/integrations/website-widget) (Docker, Reddit), in [support forms](https://docs.kapa.ai/integrations/support-form-deflector) for ticket deflection (Monday.com, Mapbox), or as [Slack bots](https://docs.kapa.ai/integrations/slack-bot) with private sources.',
'data-modal-example-questions':
'How do I install Superset?,How can I contribute to Superset?',
'data-button-text-color': 'rgb(81,166,197)',
'data-modal-header-bg-color': '#ffffff',
'data-modal-title-color': 'rgb(81,166,197)',
'data-modal-title': 'Apache Superset AI',
'data-modal-disclaimer-text-color': '#000000',
'data-consent-required': 'true',
'data-consent-screen-disclaimer':
"By clicking \"I agree, let's chat\", you consent to the use of the AI assistant in accordance with kapa.ai's [Privacy Policy](https://www.kapa.ai/content/privacy-policy). This service uses reCAPTCHA, which requires your consent to Google's [Privacy Policy](https://policies.google.com/privacy) and [Terms of Service](https://policies.google.com/terms). By proceeding, you explicitly agree to both kapa.ai's and Google's privacy policies.",
},
],
customFields: {
matomoUrl: 'https://analytics.apache.org',
matomoSiteId: '22',
},
};
export default config;