Skip to content

Commit

Permalink
chore: update docusaurus template
Browse files Browse the repository at this point in the history
Signed-off-by: aeneasr <aeneasr@users.noreply.github.com>
  • Loading branch information
aeneasr committed Aug 6, 2020
1 parent b67230d commit 124725f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 58 deletions.
11 changes: 7 additions & 4 deletions docs/README.md
Expand Up @@ -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
Expand All @@ -16,12 +16,15 @@ $ 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

```
$ 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.
118 changes: 65 additions & 53 deletions 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']
}
}

Expand All @@ -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]}`]
}
Expand All @@ -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'
}
]
}
Expand All @@ -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'
]
};
}
2 changes: 1 addition & 1 deletion docs/package.json
Expand Up @@ -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",
Expand Down

0 comments on commit 124725f

Please sign in to comment.