Skip to content

Commit c62edaf

Browse files
authored
Merge pull request #244 from GeekyAnts/fix/search-crawl-issue
Heading IDs added
2 parents fe15db8 + 3104c05 commit c62edaf

File tree

6 files changed

+28
-20
lines changed

6 files changed

+28
-20
lines changed

src/new-components/MainContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const SubMainContent2 = React.memo(({ props }: any) => {
124124
{/* */}
125125
<VStack>
126126
{!isLatestVersionSlug(activeVersion) && <Badge rounded="4" flexDir="row" alignSelf='flex-start'>version: {activeVersion}</Badge>}
127-
<Heading mb="6" size="xl" _dark={{ color: "coolGray.50" }}>
127+
<Heading nativeID="DocSearch-h1" mb="6" size="xl" _dark={{ color: "coolGray.50" }}>
128128
{frontMatter && frontMatter.title
129129
? frontMatter.title
130130
: pages.currentPage.title}

src/new-components/markdown-components/Heading1.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ import { getHeadingMeta } from "../../utils";
55
export const Heading1 = ({ children }: any) => {
66
const [content, id] = getHeadingMeta(children);
77
return (
8-
<Heading fontSize="3xl" color={useColorModeValue("gray.700", "gray.300")} />
8+
<Heading nativeID="DocSearch-h1" fontSize="3xl" color={useColorModeValue("gray.700", "gray.300")} />
99
);
1010
};

src/new-components/markdown-components/Heading2.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const Heading2 = ({ children }: any) => {
1111
{({ isHovered }) => {
1212
return (
1313
<HStack alignItems="center" space="2">
14+
<Heading display="none" nativeID="DocSearch-h2" >{content}</Heading>
1415
<Heading
1516
fontSize="2xl"
1617
_dark={{ color: "gray.300" }}

src/new-components/markdown-components/Heading3.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const Heading3 = ({ children }: any) => {
1010
{({ isHovered }) => {
1111
return (
1212
<HStack alignItems="center" space="2">
13+
<Heading display="none" nativeID="DocSearch-h3" >{content}</Heading>
1314
<Heading
1415
fontSize="xl"
1516
fontWeight="normal"

src/new-components/markdown-components/Heading4.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@ import { getHeadingMeta } from "../../utils";
55
export const Heading4 = ({ children }: any) => {
66
const [content, id] = getHeadingMeta(children);
77
return (
8-
<Heading
9-
my="2"
10-
fontSize="md"
11-
color={useColorModeValue("gray.700", "gray.300")}
12-
// @ts-ignore
13-
nativeID={id}
14-
>
15-
{content}
16-
</Heading>
8+
<>
9+
<Heading display="none" nativeID="DocSearch-h4" >{content}</Heading>
10+
<Heading
11+
my="2"
12+
fontSize="md"
13+
color={useColorModeValue("gray.700", "gray.300")}
14+
// @ts-ignore
15+
nativeID={id}
16+
>
17+
{content}
18+
</Heading>
19+
</>
1720
);
1821
};

src/new-components/markdown-components/Heading5.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ import { Heading, useColorModeValue } from "native-base";
33
import { getHeadingMeta } from "../../utils";
44

55
export const Heading5 = ({ children }: any) => {
6-
const [content,id] = getHeadingMeta(children);
6+
const [content, id] = getHeadingMeta(children);
77
return (
8-
<Heading
9-
fontSize="md"
10-
color={useColorModeValue("gray.700", "gray.300")}
11-
// @ts-ignore
12-
nativeID={id}
13-
>
14-
{content}
15-
</Heading>
8+
<>
9+
<Heading display="none" nativeID="DocSearch-h5" >{content}</Heading>
10+
<Heading
11+
fontSize="md"
12+
color={useColorModeValue("gray.700", "gray.300")}
13+
// @ts-ignore
14+
nativeID={id}
15+
>
16+
{content}
17+
</Heading>
18+
</>
1619
);
1720
};

0 commit comments

Comments
 (0)