Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 490607a

Browse files
committed
Update query/seo object names for consistency
1 parent fea72e4 commit 490607a

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

api/wordpress/_global/getPostTypeArchive.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import formatDefaultSeoData from '@/functions/formatDefaultSeoData'
66
import getMenus from '../menus/getMenus'
77

88
// Define SEO for archives.
9-
export const archiveSeo = {
9+
export const archiveQuerySeo = {
1010
post: {
11+
query: queryPostsArchive,
1112
title: 'Blog',
1213
description: ''
1314
},
1415
team: {
16+
query: queryTeamsArchive,
1517
title: 'Team Members',
1618
description: ''
1719
}
@@ -37,14 +39,8 @@ export default async function getPostTypeArchive(
3739
getNext = true,
3840
perPage = 10
3941
) {
40-
// Define single post query based on post type.
41-
const postTypeQuery = {
42-
post: queryPostsArchive,
43-
team: queryTeamsArchive
44-
}
45-
4642
// Retrieve post type query.
47-
const query = postTypeQuery?.[postType] ?? null
43+
const query = archiveQuerySeo?.[postType] ?? null
4844

4945
// Get/create Apollo instance.
5046
const apolloClient = initializeWpApollo()
@@ -114,10 +110,10 @@ export default async function getPostTypeArchive(
114110
}`
115111
}
116112
: {
117-
title: `${archiveSeo?.[postType]?.title} - ${
113+
title: `${archiveQuerySeo?.[postType]?.title} - ${
118114
response.defaultSeo?.openGraph?.siteName ?? ''
119115
}`,
120-
metaDesc: archiveSeo?.[postType]?.description,
116+
metaDesc: archiveQuerySeo?.[postType]?.description,
121117
canonical: `${response.defaultSeo?.openGraph?.url ?? ''}/${
122118
postTypes?.[postType]?.route
123119
}`,

api/wordpress/_global/getSettingsCustomPage.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import queryError404Page from '../pages/queryError404Page'
22
import processPostTypeQuery from './processPostTypeQuery'
33

44
// Define single page query based on page name.
5-
export const customPageQuery = {
5+
export const customPageQuerySeo = {
66
404: {
77
query: queryError404Page,
88
title: '404 Not Found',
@@ -19,7 +19,7 @@ export const customPageQuery = {
1919
*/
2020
export default async function getSettingsCustomPage(page) {
2121
// Retrieve page query.
22-
const query = customPageQuery?.[page]?.query ?? null
22+
const query = customPageQuerySeo?.[page]?.query ?? null
2323

2424
const data = await processPostTypeQuery('page', page, query)
2525

@@ -28,10 +28,10 @@ export default async function getSettingsCustomPage(page) {
2828
data.post = {
2929
...data?.post,
3030
seo: {
31-
title: `${customPageQuery[page]?.title ?? ''} - ${
31+
title: `${customPageQuerySeo[page]?.title ?? ''} - ${
3232
data.defaultSeo?.openGraph?.siteName ?? ''
3333
}`,
34-
description: customPageQuery[page]?.description ?? '',
34+
description: customPageQuerySeo[page]?.description ?? '',
3535
canonical: `${data.defaultSeo?.openGraph?.url ?? ''}/${page}`
3636
}
3737
}

0 commit comments

Comments
 (0)