Skip to content

Commit 1b9b92c

Browse files
authored
Merge pull request #1341 from prezly/feature/dev-21191-rac-site-seo-clarification-on-2-h1s-appearing-in-their-site
[DEV-21191] Fix - Do not render extra page title on category/tag pages
2 parents d8918fc + 0a80194 commit 1b9b92c

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

src/modules/InfiniteStories/InfiniteStories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Props = {
3131
storyCardVariant: ThemeSettings['story_card_variant'];
3232
tag?: string;
3333
total: number;
34+
withPageTitle?: boolean;
3435
};
3536

3637
function fetchStories(props: {
@@ -69,6 +70,7 @@ export function InfiniteStories({
6970
storyCardVariant,
7071
tag,
7172
total,
73+
withPageTitle,
7274
}: Props) {
7375
const locale = useLocale();
7476
const { load, loading, data, done } = useInfiniteLoading(
@@ -102,6 +104,7 @@ export function InfiniteStories({
102104
showSubtitle={showSubtitle}
103105
stories={data}
104106
storyCardVariant={storyCardVariant}
107+
withPageTitle={withPageTitle}
105108
/>
106109

107110
{!done && (

src/modules/InfiniteStories/StoriesList.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Props = {
3535
stories: ListStory[];
3636
storyCardVariant: ThemeSettings['story_card_variant'];
3737
withEmptyState?: boolean;
38+
withPageTitle?: boolean;
3839
};
3940

4041
export function StoriesList({
@@ -51,6 +52,7 @@ export function StoriesList({
5152
stories,
5253
storyCardVariant,
5354
withEmptyState = true,
55+
withPageTitle,
5456
}: Props) {
5557
const locale = useLocale();
5658
const { formatMessage } = useIntl();
@@ -113,14 +115,16 @@ export function StoriesList({
113115
})}
114116
</div>
115117
)}
116-
<PageTitle
117-
className={classNames(styles.pageTitle, {
118-
// We want to hide the page title for regular users, but keep it
119-
// for the screen readers.
120-
[styles.aria]: isCategoryList ? !hasStories : !hasCategories,
121-
})}
122-
title={formatMessage(translations.homepage.latestStories)}
123-
/>
118+
{withPageTitle && (
119+
<PageTitle
120+
className={classNames(styles.pageTitle, {
121+
// We want to hide the page title for regular users, but keep it
122+
// for the screen readers.
123+
[styles.aria]: isCategoryList ? !hasStories : !hasCategories,
124+
})}
125+
title={formatMessage(translations.homepage.latestStories)}
126+
/>
127+
)}
124128
{hasCategories && (
125129
<CategoriesFilters
126130
activeCategory={category}

src/modules/Stories/Stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export async function Stories({
5353
showSubtitle={showSubtitle}
5454
storyCardVariant={storyCardVariant}
5555
total={pagination.matched_records_number}
56+
withPageTitle
5657
/>
5758
);
5859
}

0 commit comments

Comments
 (0)