Skip to content

Commit 4d873f8

Browse files
committed
Set canonical link for blogs, webinars, and specific subjects pages
1 parent 1752634 commit 4d873f8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/app/pages/blog/blog.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React, {useEffect} from 'react';
22
import useBlogContext, {BlogContextProvider} from './blog-context';
33
import {Routes, Route, useLocation, useParams} from 'react-router-dom';
44
import {WindowContextProvider} from '~/contexts/window';
5-
import useDocumentHead from '~/helpers/use-document-head';
5+
import useDocumentHead, {useCanonicalLink} from '~/helpers/use-document-head';
66
import RawHTML from '~/components/jsx-helpers/raw-html';
77
import ExploreBySubject from '~/components/explore-by-subject/explore-by-subject';
88
import ExploreByCollection from '~/components/explore-by-collection/explore-by-collection';
@@ -108,6 +108,8 @@ export default function LoadBlog() {
108108
const location = useLocation();
109109
const TopLevelPage = location.search ? SearchResultsPage : MainBlogPage;
110110

111+
useCanonicalLink();
112+
111113
return (
112114
<main className="blog page">
113115
<BlogContextProvider>

src/app/pages/subjects/new/specific/specific.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import LazyLoad from 'react-lazyload';
1717
import useFoundSubject from './use-found-subject';
1818
import AboutOpenStax from '../about-openstax';
1919
import {InfoBoxes} from '../info-boxes';
20+
import { useCanonicalLink } from '~/helpers/use-document-head';
2021
import cn from 'classnames';
2122
import './specific.scss';
2223

@@ -153,6 +154,8 @@ export default function LoadSubject() {
153154
const foundSubject = useFoundSubject();
154155
const timedOut = useDebounceTest(!foundSubject);
155156

157+
useCanonicalLink();
158+
156159
if (!foundSubject) {
157160
// The timeout allows contexts that may just be in a transitional state
158161
// to resolve (if they're going to) before trying alternatives

src/app/pages/webinars/webinars.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import {WebinarContextProvider} from './webinar-context';
33
import {Routes, Route} from 'react-router-dom';
4+
import {useCanonicalLink} from '~/helpers/use-document-head';
45
import JITLoad from '~/helpers/jit-load';
56
import './webinars.scss';
67

@@ -12,6 +13,8 @@ const importSearch = () => import('./import-search-page');
1213

1314

1415
export default function WebinarsLoader() {
16+
useCanonicalLink();
17+
1518
return (
1619
<main className='webinars page'>
1720
<WebinarContextProvider>

0 commit comments

Comments
 (0)