aboutsummaryrefslogtreecommitdiff
path: root/docusaurus.config.js
diff options
context:
space:
mode:
author安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com>2024-05-22 17:42:29 +0900
committer安竹洋平 <61961825+yasutakeyohei@users.noreply.github.com>2024-05-22 17:42:29 +0900
commit8228299eec0148e8c213bb760bf011e9f6304769 (patch)
tree860e23336af04505d53554b1f657aec7cae13a00 /docusaurus.config.js
parent0f0f632b3b568702f92941cf9b0f70ed475714af (diff)
サイドバーでindex表示しないよう修正
Diffstat (limited to 'docusaurus.config.js')
-rw-r--r--docusaurus.config.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/docusaurus.config.js b/docusaurus.config.js
index c339ace5..bbd3e0e5 100644
--- a/docusaurus.config.js
+++ b/docusaurus.config.js
@@ -8,6 +8,14 @@ import {themes as prismThemes} from 'prism-react-renderer';
import admonitionTitleToHeadingBeforeTOC from './src/remark/admonition-title-to-heading-before-toc.js';
import admonitionTitleToHeadingAfterTOC from './src/rehype/admonition-title-to-heading-after-toc.js';
+// sidebarItemsGenerator用
+function skipIndex(items) {
+ return items.filter(({ type, id }) => {
+ return type !== 'doc' || id !== 'ippan-situmon/index';
+ });
+}
+
+
/** @type {import('@docusaurus/types').Config} */
const config = {
title: '東京都小平市議・安竹洋平のまとめ',
@@ -66,6 +74,16 @@ const config = {
beforeDefaultRemarkPlugins: [admonitionTitleToHeadingBeforeTOC],
rehypePlugins: [admonitionTitleToHeadingAfterTOC],
showLastUpdateTime: true,
+ /*
+ autogeneratedとすると、indexも含まれてしまう。docusaurus以降のバージョンでは省けるようになるかもしれないが、
+ https://github.com/facebook/docusaurus/issues/6127
+ 今のところは回避策としてsidebarItemsGeneratorを使ってdocディレクトリ下のindexをページで省くようにする
+ https://stackoverflow.com/a/75046777
+ */
+ async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) {
+ const sidebarItems = await defaultSidebarItemsGenerator(args);
+ return skipIndex(sidebarItems);
+ }
},
blog: {
blogTitle: 'ふらっとブログ',