Skip to content

Commit

Permalink
fix(openapi): fix missing page title (#2175)
Browse files Browse the repository at this point in the history
* fix(openapi): add page title for OpenApiDocsView

* fix(api-docs-view): add page title for ApiDocsView
  • Loading branch information
zchsh authored Sep 25, 2023
1 parent 0bb9084 commit b2a03a7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ export async function getApiDocsStaticProps({
*/
return {
props: {
metadata: {
title: schema.info.title,
},
product: productData,
pageHeading,
layoutProps: {
Expand Down
9 changes: 9 additions & 0 deletions src/views/api-docs-view/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ export interface ApiDocsVersionData {
* Props needed to render `ApiDocsView`.
*/
export interface ApiDocsViewProps {
/**
* Metadata is used to set the page title and description.
* Note this is not used by the view itself, instead we have some magic
* happening at the `_app.tsx` level, where we render `<HeadMetadata />`.
*/
metadata: {
title: string
}

/**
* Layout props drive the breadcrumbs and sidebar in the
* SidebarSidecarLayout we use to render API docs.
Expand Down
4 changes: 3 additions & 1 deletion src/views/open-api-docs-view/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ export async function getStaticProps({
*/
return {
props: {
metadata: {
title: schemaData.info.title,
},
productData,
topOfPageHeading: {
text: schemaData.info.title,
id: topOfPageId,
},
releaseStage: targetVersion.releaseStage,
descriptionMdx,
IS_REVISED_TEMPLATE: true,
_placeholder: {
productSlug,
targetVersion,
Expand Down
10 changes: 9 additions & 1 deletion src/views/open-api-docs-view/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,15 @@ export interface StatusIndicatorConfig {
* For now, we have a placeholder. We'll expand this as we build out the view.
*/
export interface OpenApiDocsViewProps {
IS_REVISED_TEMPLATE: true
/**
* Metadata is used to set the page title and description.
* Note this is not used by the view itself, instead we have some magic
* happening at the `_app.tsx` level, where we render `<HeadMetadata />`.
*/
metadata: {
title: string
}

productData: ProductData
topOfPageHeading: {
text: string
Expand Down

1 comment on commit b2a03a7

@vercel
Copy link

@vercel vercel bot commented on b2a03a7 Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.