docusaurus.config.ts (190 lines of code) (raw):

/* * 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 * as Preset from '@docusaurus/preset-classic'; const projectName = "Gravitino"; const mainRepoName = "gravitino"; const siteRepoName = "gravitino-site"; const fs = require('fs') const currentVersion = fs.readFileSync('CURRENT_VERSION', 'utf-8').replace(/\n/g, '').trim() const config: Config = { title: `Apache ${projectName}`, tagline: `Welcome to Apache ${projectName}!`, favicon: 'img/favicon.ico', url: `https://${projectName.toLowerCase()}.apache.org/`, baseUrl: '/', onBrokenLinks: 'warn', onBrokenMarkdownLinks: 'warn', // Even if you don't use internationalization, you can use this field to set // useful metadata like html lang. For example, if your site is Chinese, you // may want to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', locales: ['en'], }, markdown: { mermaid: true }, plugins: [ './src/plugins/postcss-tailwind-loader', [ '@docusaurus/plugin-client-redirects', { createRedirects(existingPath) { if (existingPath.includes(`/docs/${currentVersion}`)) { return [ existingPath.replace(`/docs/${currentVersion}`, '/docs/latest'), existingPath.replace(`/docs/${currentVersion}`, '/docs/'), ]; } return undefined; }, } ], [ '@docusaurus/plugin-ideal-image', { quality: 70, max: 1030, min: 640, steps: 2, disableInDev: false } ], [ 'docusaurus-plugin-openapi-docs', { id: 'openapi', docsPluginId: 'classic', config: { gravitino: { specPath: 'docs/open-api/openapi.yaml', outputDir: 'docs/api/rest', sidebarOptions: { groupPathsBy: 'tag', categoryLinkSource: 'tag' } } } } ], ], presets: [ [ 'classic', { docs: { sidebarPath: './docs/sidebars.ts', editUrl: ({ docPath }) => `https://github.com/apache/${siteRepoName}/tree/main/docs/${docPath}`, docItemComponent: '@theme/ApiItem', lastVersion: currentVersion, versions: { [currentVersion]: { label: currentVersion, path: currentVersion } }, showLastUpdateTime: false, showLastUpdateAuthor: false }, blog: { blogSidebarCount: 'ALL', blogSidebarTitle: 'All our posts', showReadingTime: true, editUrl: ({ blogPath }) => `https://github.com/apache/${siteRepoName}/tree/main/blog/${blogPath}`, }, theme: { customCss: './src/css/custom.css', }, } satisfies Preset.Options, ], ], themeConfig: { // TODO: Replace with your project's social card image: 'img/social-card.png', colorMode: { defaultMode: 'light', disableSwitch: true, }, navbar: { logo: { alt: 'Logo', src: 'img/logo.svg', }, items: [ {to: '/', label: 'Apache Gravitino', position: 'left'}, {to: '/community', label: 'Community', position: 'right'}, {to: '/contrib', label: 'Contributing', position: 'right'}, {to: '/downloads', label: 'Downloads', position: 'right'}, {type: 'docSidebar', sidebarId: 'docs', position: 'right', label: 'Docs'}, {to: '/blog', label: 'Blog', position: 'right'}, { type: 'dropdown', label: 'ASF', position: 'right', items: [ { label: 'Foundation', to: 'https://www.apache.org/' }, { label: 'License', to: 'https://www.apache.org/licenses/' }, { label: 'Events', to: 'https://www.apache.org/events/current-event.html' }, { label: 'Privacy', to: 'https://privacy.apache.org/policies/privacy-policy-public.html' }, { label: 'Security', to: 'https://www.apache.org/security/' }, { label: 'Sponsorship', to: 'https://www.apache.org/foundation/sponsorship.html' }, { label: 'Thanks', to: 'https://www.apache.org/foundation/thanks.html' }, { label: 'Code of Conduct', to: 'https://github.com/apache/gravitino/blob/main/CODE_OF_CONDUCT.md' } ] }, { href: `https://github.com/apache/${mainRepoName}`, position: 'right', className: 'header-github-link', 'aria-label': 'GitHub repository', }, ], }, footer: { style: 'dark', links: [], logo: { width: 200, src: "/img/apache-incubator.svg", href: "https://incubator.apache.org/", alt: "Apache Incubator logo" }, copyright: `<div> <p> Apache ${projectName} is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF. </p> <p> Copyright © ${new Date().getFullYear()} The Apache Software Foundation, Licensed under the Apache License, Version 2.0. <br/> Apache Gravitino, the names of other Apache projects, and the ASF logo are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries. </p> </div>`, }, } satisfies Preset.ThemeConfig, themes: ['docusaurus-theme-openapi-docs', '@docusaurus/theme-mermaid'], scripts: [ { src: 'js/matomo.js', async: true, }, ] }; export default config;