diff --git a/docs/README.md b/docs/README.md index f0b10c675..8b5f51758 100644 --- a/docs/README.md +++ b/docs/README.md @@ -4,8 +4,8 @@ This directory contains the project's documentation. ## Develop -To change the documentation locally, you need NodeJS installed. -Next, install the dependencies: +To change the documentation locally, you need NodeJS installed. Next, install +the dependencies: ``` $ npm @@ -16,7 +16,9 @@ $ npm ``` $ npm start ``` -This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. + +This command starts a local development server and open up a browser window. +Most changes are reflected live without having to restart the server. ### Build @@ -24,4 +26,5 @@ This command starts a local development server and open up a browser window. Mos $ npm build ``` -This command generates static content into the `build` directory and can be served using any static contents hosting service. +This command generates static content into the `build` directory and can be +served using any static contents hosting service. diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 43ac2153f..3c81074c9 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -1,51 +1,58 @@ -const config = require("./contrib/config.js"); -const fs = require("fs"); -const admonitions = require("remark-admonitions"); +const config = require('./contrib/config.js') +const fs = require('fs') +const admonitions = require('remark-admonitions') + +const githubRepoName = config.projectSlug === 'ecosystem' + ? 'docs' + : config.projectSlug const links = [ { - to: "index", + to: 'index', activeBasePath: `${config.projectSlug}/docs`, label: `Docs`, - position: "left" + position: 'left' }, { - href: "https://www.ory.sh/docs", - label: "Ecosystem", - position: "left" + href: 'https://www.ory.sh/docs', + label: 'Ecosystem', + position: 'left' }, { - href: "https://www.ory.sh/blog", label: "Blog", - position: "left" + href: 'https://www.ory.sh/blog', + label: 'Blog', + position: 'left' }, { - href: "https://community.ory.sh", label: "Forum", - position: "left" + href: 'https://community.ory.sh', + label: 'Forum', + position: 'left' }, { - href: "https://www.ory.sh/chat", label: "Chat", - position: "left" + href: 'https://www.ory.sh/chat', + label: 'Chat', + position: 'left' }, { - href: `https://github.com/ory/${config.projectSlug}`, - label: "GitHub", - position: "left" + href: `https://github.com/ory/${githubRepoName}`, + label: 'GitHub', + position: 'left' } -]; +] -let version = ["latest"]; +let version = ['latest'] -if (fs.existsSync("./versions.json")) { - version = require("./versions.json"); +if (fs.existsSync('./versions.json')) { + version = require('./versions.json') if (version && version.length > 0) { links.push({ label: version[0], - position: "right", - to: "versions" - }); + position: 'right', + to: 'versions' + }) } if (version.length === 0) { - version = ["master"]; + version = ['master'] } } @@ -54,17 +61,17 @@ module.exports = { tagline: config.projectTagLine, url: `https://www.ory.sh/`, baseUrl: `/${config.projectSlug}/docs/`, - favicon: "img/favico.png", - organizationName: "ory", // Usually your GitHub org/user name. + favicon: 'img/favico.png', + organizationName: 'ory', // Usually your GitHub org/user name. projectName: config.projectSlug, // Usually your repo name. themeConfig: { googleAnalytics: { - trackingID: "UA-71865250-1", + trackingID: 'UA-71865250-1', anonymizeIP: true }, algolia: { - apiKey: "8463c6ece843b377565726bb4ed325b0", - indexName: "ory", + apiKey: '8463c6ece843b377565726bb4ed325b0', + indexName: 'ory', algoliaOptions: { facetFilters: [`tags:${config.projectSlug}`, `version:${version[0]}`] } @@ -73,28 +80,28 @@ module.exports = { logo: { alt: config.projectName, src: `img/logo-${config.projectSlug}.svg`, - href: `https://www.ory.sh/${config.projectSlug}` + href: `https://www.ory.sh/${config.projectSlug === 'ecosystem' ? '' : config.projectSlug}` }, items: links }, footer: { - style: "dark", + style: 'dark', copyright: `Copyright © ${new Date().getFullYear()} ORY GmbH`, links: [ { - title: "Company", + title: 'Company', items: [ { - label: "Imprint", - href: "https://www.ory.sh/imprint" + label: 'Imprint', + href: 'https://www.ory.sh/imprint' }, { - label: "Privacy", - href: "https://www.ory.sh/privacy" + label: 'Privacy', + href: 'https://www.ory.sh/privacy' }, { - label: "Terms", - href: "https://www.ory.sh/tos" + label: 'Terms', + href: 'https://www.ory.sh/tos' } ] } @@ -103,30 +110,35 @@ module.exports = { }, plugins: [ [ - "@docusaurus/plugin-content-docs", + '@docusaurus/plugin-content-docs', { - path: config.projectSlug === "docusaurus-template" ? "contrib/docs" : "docs", - sidebarPath: require.resolve("./contrib/sidebar.js"), - editUrl: - `https://github.com/ory/${config.projectSlug}/edit/master/docs`, - routeBasePath: "", - homePageId: "index", + path: + config.projectSlug === 'docusaurus-template' + ? 'contrib/docs' + : 'docs', + sidebarPath: require.resolve('./contrib/sidebar.js'), + editUrl: `https://github.com/ory/${githubRepoName}/edit/master/docs`, + routeBasePath: '', + homePageId: 'index', showLastUpdateAuthor: true, showLastUpdateTime: true, remarkPlugins: [admonitions] } ], - "@docusaurus/plugin-content-pages", - "@docusaurus/plugin-google-analytics", - "@docusaurus/plugin-sitemap" + '@docusaurus/plugin-content-pages', + '@docusaurus/plugin-google-analytics', + '@docusaurus/plugin-sitemap' ], themes: [ [ - "@docusaurus/theme-classic", + '@docusaurus/theme-classic', { - customCss: config.projectSlug === "docusaurus-template" ? require.resolve("./contrib/theme.css") : require.resolve("./src/css/theme.css") + customCss: + config.projectSlug === 'docusaurus-template' + ? require.resolve('./contrib/theme.css') + : require.resolve('./src/css/theme.css') } ], - "@docusaurus/theme-search-algolia" + '@docusaurus/theme-search-algolia' ] -}; +} diff --git a/docs/package.json b/docs/package.json index b1eac6aa6..2093fd79c 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,7 +9,7 @@ "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", - "format": "prettier --write '{docs/**,docs,scripts,static,contrib}/*.{md,mdx,json,js,css,html}' --no-semi --single-quote --trailing-comma none || true" + "format": "prettier --write '{docs/**,docs,scripts,static,contrib}/*.{md,mdx,json,js,css,html}|*.{js,md}' --no-semi --single-quote --trailing-comma none || true" }, "dependencies": { "@docusaurus/core": "2.0.0-alpha.61",