Skip to content

Commit 0b10460

Browse files
jacobloganJacob Logan
andauthored
remove pageMain anchor from search results (#7606)
* add transform to search to remove main anchor tag * comment on transform function --------- Co-authored-by: Jacob Logan <[email protected]>
1 parent f816685 commit 0b10460

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/components/Layout/LayoutHeader.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,16 @@ export const LayoutHeader = ({
5151
}
5252
};
5353

54+
// Search result transform function that will strip out the pageMain anchor tag
55+
const transformItems = (items) => {
56+
items.map((item) => {
57+
if (item.url.includes('#pageMain')) {
58+
item.url = item.url.replace('#pageMain', '');
59+
}
60+
});
61+
return items;
62+
};
63+
5464
return (
5565
<View as="header" className="layout-header">
5666
<Flex className={`layout-search layout-search--${pageType}`}>
@@ -82,6 +92,7 @@ export const LayoutHeader = ({
8292
`gen:${isGen1 ? 'gen1' : 'gen2'}`
8393
]
8494
}}
95+
transformItems={transformItems}
8596
/>
8697
</View>
8798
</View>

0 commit comments

Comments
 (0)