Disable color theme switch & remove code filtering sidebar items

This commit is contained in:
Serafeim Chatzopoulos 2022-12-15 20:04:15 +02:00
parent e3fb581270
commit 440e8c5b9c
2 changed files with 10 additions and 35 deletions

View File

@ -5,11 +5,10 @@ const lightCodeTheme = require('prism-react-renderer/themes/github');
const darkCodeTheme = require('prism-react-renderer/themes/dracula'); const darkCodeTheme = require('prism-react-renderer/themes/dracula');
const math = require('remark-math'); const math = require('remark-math');
const katex = require('rehype-katex'); const katex = require('rehype-katex');
const { filterItems } = require('./sidebar-utils');
/** @type {import('@docusaurus/types').Config} */ /** @type {import('@docusaurus/types').Config} */
const config = { const config = {
title: 'OpenAIRE Documentation', title: 'OpenAIRE Research Graph Documentation',
tagline: 'Open Access Infrastructure for Research in Europe', tagline: 'Open Access Infrastructure for Research in Europe',
url: 'http://snf-23385.ok-kno.grnetcloud.net', url: 'http://snf-23385.ok-kno.grnetcloud.net',
baseUrl: '/', // serve the website at route baseUrl: '/', // serve the website at route
@ -37,18 +36,7 @@ const config = {
({ ({
docs: { docs: {
routeBasePath: '/', // serve the docs at the site's route routeBasePath: '/', // serve the docs at the site's route
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve('./sidebars.js'),
async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
const itemsToFilterOut = [
'data-model/entities/entity-identifiers',
'data-model/entities/other'
];
return filterItems(sidebarItems, itemsToFilterOut);
},
// Please change this to your repo. // Please change this to your repo.
// Remove this to remove the "edit this page" links. // Remove this to remove the "edit this page" links.
// editUrl: // editUrl:
@ -64,7 +52,7 @@ const config = {
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: require.resolve('./src/css/custom.css'),
}, },
sitemap: { sitemap: {
changefreq: 'monthly', changefreq: 'monthly',
priority: 0.5, priority: 0.5,
ignorePatterns: ['/tags/**'], ignorePatterns: ['/tags/**'],
@ -105,14 +93,14 @@ const config = {
type: 'docsVersionDropdown', type: 'docsVersionDropdown',
position: 'right' position: 'right'
}, },
//
// link to blog, the blog must be enabled first // link to blog, the blog must be enabled first
// {to: '/blog', label: 'Blog', position: 'left'}, // {to: '/blog', label: 'Blog', position: 'left'},
//
// link to github repo // link to github repo
// { // {
// href: 'https://github.com/facebook/docusaurus', // href: 'https://github.com/facebook/docusaurus',
// label: 'GitHub', // label: 'Issues',
// position: 'right', // position: 'right',
// }, // },
], ],
@ -179,6 +167,11 @@ const config = {
], ],
copyright: `Copyright © ${new Date().getFullYear()} OpenAIRE`, copyright: `Copyright © ${new Date().getFullYear()} OpenAIRE`,
}, },
colorMode: {
defaultMode: 'light',
disableSwitch: true,
respectPrefersColorScheme: false,
},
prism: { prism: {
theme: lightCodeTheme, theme: lightCodeTheme,
darkTheme: darkCodeTheme, darkTheme: darkCodeTheme,

View File

@ -1,18 +0,0 @@
// filter out specific items from the sidebar
function filterItems(items, itemsToFilter) {
// filter out items of categories
let result = items.map((item) => {
if (item.type === 'category') {
return {...item, items: filterItems(item.items, itemsToFilter)};
}
return item;
});
// filter out items in current level
return result.filter( item => !itemsToFilter.includes(item.id) );
}
module.exports = {
filterItems
};