@defra/docusaurus-theme-govuk 0.0.8-alpha → 0.0.9-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {useDoc} from '../docContext';
|
|
3
3
|
import MDXContent from '@theme/MDXContent';
|
|
4
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
4
5
|
|
|
5
6
|
// Render a synthetic title if needed
|
|
6
7
|
function useSyntheticTitle() {
|
|
7
8
|
const {metadata, frontMatter, contentTitle} = useDoc();
|
|
9
|
+
const {siteConfig} = useDocusaurusContext();
|
|
8
10
|
const shouldRender =
|
|
9
11
|
!frontMatter.hide_title &&
|
|
10
12
|
typeof contentTitle === 'undefined' &&
|
|
@@ -12,6 +14,10 @@ function useSyntheticTitle() {
|
|
|
12
14
|
if (!shouldRender) {
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
17
|
+
// For the root index page, use the Docusaurus site title instead of the filename
|
|
18
|
+
if (metadata.title?.toLowerCase() === 'index') {
|
|
19
|
+
return siteConfig.title;
|
|
20
|
+
}
|
|
15
21
|
return metadata.title;
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Head from '@docusaurus/Head';
|
|
3
3
|
import {useDoc} from '../docContext';
|
|
4
|
+
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
4
5
|
|
|
5
6
|
export default function DocItemMetadata() {
|
|
6
7
|
const {metadata} = useDoc();
|
|
7
|
-
const {
|
|
8
|
+
const {siteConfig} = useDocusaurusContext();
|
|
9
|
+
const {description} = metadata;
|
|
10
|
+
// Use the Docusaurus site title for root index pages instead of the filename
|
|
11
|
+
const title = metadata.title?.toLowerCase() === 'index'
|
|
12
|
+
? siteConfig.title
|
|
13
|
+
: metadata.title;
|
|
8
14
|
|
|
9
15
|
return (
|
|
10
16
|
<Head>
|