Skip to content

Commit 7a4666c

Browse files
authored
conditionally apply info template (#1137)
1 parent f554dc0 commit 7a4666c

File tree

1 file changed

+11
-5
lines changed
  • packages/docusaurus-plugin-openapi-docs/src

1 file changed

+11
-5
lines changed

packages/docusaurus-plugin-openapi-docs/src/index.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,17 @@ custom_edit_url: null
383383
if (item.type === "info") {
384384
if (!fs.existsSync(`${outputDir}/${item.id}.info.mdx`)) {
385385
try {
386-
fs.writeFileSync(
387-
`${outputDir}/${item.id}.info.mdx`,
388-
utils,
389-
"utf8"
390-
);
386+
sidebarOptions?.categoryLinkSource === "info" || infoTemplate // Only use utils template if set to "info" or if infoTemplate is set
387+
? fs.writeFileSync(
388+
`${outputDir}/${item.id}.info.mdx`,
389+
utils,
390+
"utf8"
391+
)
392+
: fs.writeFileSync(
393+
`${outputDir}/${item.id}.info.mdx`,
394+
view,
395+
"utf8"
396+
);
391397
console.log(
392398
chalk.green(
393399
`Successfully created "${outputDir}/${item.id}.info.mdx"`

0 commit comments

Comments
 (0)