Skip to main content

AddNewSection

Adding New Prompts Section


🔧 Setup for Multiple Docs Sections

Your docusaurus.config.js should look like this:

// @ts-check
import { themes as prismThemes } from "prism-react-renderer";

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "DGL Documentation",
tagline: "Documentation for all Projects in DGL Ecosystem",
favicon: "img/favicon.ico",

future: { v4: true },

url: "https://dgl-documentation.vercel.app/",
baseUrl: "/",

organizationName: "facebook",
projectName: "docusaurus",

onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",

i18n: {
defaultLocale: "en",
locales: ["en"],
},

// ✅ Keep the main preset-classic with default `docs` + `blog`
presets: [
[
"classic",
{
docs: {
sidebarPath: "./sidebars.js",
editUrl: "https://github.com/RusiruChathushanaka/DGL_Documentation",
},
blog: {
showReadingTime: true,
feedOptions: { type: ["rss", "atom"], xslt: true },
editUrl: "https://github.com/RusiruChathushanaka/DGL_Documentation",
onInlineTags: "warn",
onInlineAuthors: "warn",
onUntruncatedBlogPosts: "warn",
},
theme: { customCss: "./src/css/custom.css" },
},
],
],

// ✅ Add a SECOND docs plugin instance here
plugins: [
[
"@docusaurus/plugin-content-docs",
{
id: "prompts", // Unique ID
path: "prompts", // Your /prompts folder with .md files
routeBasePath: "prompts", // URL will be /prompts/*
sidebarPath: "./sidebarsPrompts.js", // separate sidebar
},
],
],

themeConfig: {
image: "img/docusaurus-social-card.jpg",
navbar: {
title: "DGL Documentation",
logo: {
alt: "DGL Documentation Logo",
src: "img/logo.svg",
},
items: [
{
type: "docSidebar",
sidebarId: "tutorialSidebar",
position: "left",
label: "Tutorial",
},
{
type: "docSidebar",
docsPluginId: "prompts", // 👈 needed for multiple docs
sidebarId: "promptsSidebar",
position: "left",
label: "Prompts",
},
{ to: "/blog", label: "Blog", position: "left" },
{
href: "https://github.com/RusiruChathushanaka/DGL_Documentation",
label: "GitHub",
position: "right",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Docs",
items: [{ label: "Tutorial", to: "/docs/intro" }],
},
{
title: "Community",
items: [
{
label: "Stack Overflow",
href: "https://stackoverflow.com/questions/tagged/docusaurus",
},
{
label: "Discord",
href: "https://discordapp.com/invite/docusaurus",
},
{ label: "X", href: "https://x.com/docusaurus" },
],
},
{
title: "More",
items: [
{ label: "Blog", to: "/blog" },
{
label: "GitHub",
href: "https://github.com/RusiruChathushanaka/DGL_Documentation",
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} My Project, Inc. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
},
},
};

export default config;

🔧 Step 2: Make sidebarsPrompts.js

/**
* Prompts Sidebar
* @type {import('@docusaurus/plugin-content-docs').SidebarsConfig}
*/
const sidebarsPrompts = {
promptsSidebar: [
{
type: "autogenerated",
dirName: ".", // Autogenerate from "prompts" folder
},
],
};

export default sidebarsPrompts;

✅ After This

  • Your Tutorial docs stay under /docs/...
  • Your Prompts docs live under /prompts/... (with sidebar from the /prompts folder)
  • Navbar has Tutorial | Prompts | Blog
  • Each section behaves independently 🎉

⚡ Question: Do you want your /prompts sidebar autogenerated (like above), or do you prefer a manual grouped structure (e.g. categories ChatGPT, Claude, etc.)?