@@ -3,13 +3,15 @@ import {
33 DEFAULT_STOPLIGHT_LAYOUT ,
44 DEFAULT_TITLE ,
55 DEFAULT_API_DOC_PLATFORM ,
6+ DEFAULT_META_DESCRIPTION ,
67} from '@/core/constant'
78import { NodeJSApiDocHandler } from '@/core/server'
89import { IStoplight } from '@/core/type'
910import { ApiDocPlatformType } from '@/core/web'
1011
1112type Config = {
1213 title : string
14+ metaDescription : string
1315 apiDocPlatfomDefault : ApiDocPlatformType
1416 apiDocPlatfomLayout : string
1517 path : string
@@ -22,6 +24,12 @@ type BaseConfigOnConstructor = {
2224 */
2325 title ?: string
2426
27+ /**
28+ * The page meta description
29+ * @default "API Documentation"
30+ */
31+ metaDescription ?: string
32+
2533 /**
2634 * the default of doc path, the value should have / in prefix
2735 * @default "/docs"
@@ -104,7 +112,11 @@ class JSApiDocBaseFramework {
104112 *
105113 */
106114 constructor ( app : any , document : object , config : ConfigOnConstructor = { } ) {
107- const { customPath = DEFAULT_PATH , title = DEFAULT_TITLE } = config
115+ const {
116+ customPath = DEFAULT_PATH ,
117+ title = DEFAULT_TITLE ,
118+ metaDescription = DEFAULT_META_DESCRIPTION ,
119+ } = config
108120
109121 let layout = ''
110122 let apiDocPlatformType : ApiDocPlatformType =
@@ -126,6 +138,7 @@ class JSApiDocBaseFramework {
126138 this . document = document
127139 this . config = {
128140 title,
141+ metaDescription,
129142 apiDocPlatfomDefault : apiDocPlatformType ,
130143 path : customPath ,
131144 apiDocPlatfomLayout : layout ,
0 commit comments