@@ -8,6 +8,7 @@ import { Divider, Title } from "@mantine/core";
8
8
import PrevNextEditButtons from "./PrevNextEditButtons" ;
9
9
import path from "path" ;
10
10
import { DocMetadata } from "@/docs-collection-types" ;
11
+ import { compareMajorMinor } from "../../../../scripts/utils" ;
11
12
12
13
// Next.js uses this function at build time to figure out which
13
14
// docs pages it should statically generate.
@@ -82,6 +83,18 @@ export default async function DocsPage({
82
83
( docMeta . version === docMeta . latestVersion &&
83
84
! docMeta . slug . startsWith ( docMeta . versionRoot ) ) ;
84
85
86
+ // The Markdown format was changed in Prometheus >3.4 and Alertmanager >0.28
87
+ // to not include the H1 title in the Markdown content itself, so we need to
88
+ // externally render the title using the frontmatter `title` field instead..
89
+ const useFrontmatterTitle =
90
+ docMeta . type === "local-doc" ||
91
+ ( docMeta . type === "repo-doc" &&
92
+ docMeta . owner === "prometheus" &&
93
+ ( ( docMeta . repo === "prometheus" &&
94
+ compareMajorMinor ( docMeta . version , "3.4" ) === 1 ) ||
95
+ ( docMeta . repo === "alertmanager" &&
96
+ compareMajorMinor ( docMeta . version , "0.28" ) === 1 ) ) ) ;
97
+
85
98
return (
86
99
< >
87
100
< VersionWarning currentPage = { docMeta } />
@@ -93,9 +106,7 @@ export default async function DocsPage({
93
106
) } `,
94
107
} }
95
108
>
96
- { docMeta . type === "local-doc" && (
97
- < Title order = { 1 } > { docMeta . title } </ Title >
98
- ) }
109
+ { useFrontmatterTitle && < Title order = { 1 } > { docMeta . title } </ Title > }
99
110
< PromMarkdown
100
111
normalizeHref = { ( href : string | undefined ) => {
101
112
if ( ! href ) {
0 commit comments