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

Commit 7596a0f

Browse files
committed
Merge branch 'feature/33-post-archive-page-redirect' into develop
2 parents 184b7a9 + 3131a00 commit 7596a0f

File tree

6 files changed

+32
-26
lines changed

6 files changed

+32
-26
lines changed

api/wordpress/pages/queryPageById.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const queryPageById = gql`
2525
) {
2626
page(id: $id, idType: $idType) {
2727
...SinglePageFields
28+
isPostsPage
2829
}
2930
}
3031
${singlePageFragment}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
"dayjs": "^1.10.3",
5959
"deepmerge": "^4.2.2",
6060
"eslint": "^7.18.0",
61-
"eslint-config-prettier": "^7.1.0",
61+
"eslint-config-prettier": "^7.2.0",
6262
"eslint-plugin-import": "^2.22.1",
63-
"eslint-plugin-jsdoc": "^31.0.6",
63+
"eslint-plugin-jsdoc": "^31.0.7",
6464
"eslint-plugin-jsx-a11y": "^6.4.1",
6565
"eslint-plugin-prettier": "^3.3.1",
6666
"eslint-plugin-react": "^7.22.0",

pages/[...slug].js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ export default function Page({post}) {
4747
/>
4848
</article>
4949
</section>
50-
{post.slug === 'form-demo' && <BlockGravityForm {...post?.blocks[0]} />}
50+
{post?.slug === 'form-demo' && (
51+
<BlockGravityForm {...post?.blocks[0]} />
52+
)}
5153
</div>
5254
</Layout>
5355
)

pages/_app.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import '@/styles/index.css'
33
import {ApolloProvider} from '@apollo/client'
44
import {DefaultSeo} from 'next-seo'
55
import Error from 'next/error'
6-
import {useState} from 'react'
6+
import {useState, useEffect} from 'react'
77
import PropTypes from 'prop-types'
88
import AlgoliaProvider from '@/components/common/AlgoliaProvider'
99
import MenuProvider from '@/components/common/MenuProvider'
10+
import {useRouter} from 'next/router'
1011

1112
/**
1213
* Render the App component.
@@ -25,6 +26,17 @@ export default function App({Component, pageProps}) {
2526
*/
2627
const apolloClient = useApollo(pageProps)
2728

29+
const router = useRouter()
30+
31+
// Redirect from WP blog archive to FE posts archive.
32+
useEffect(() => {
33+
if (!pageProps?.post?.isPostsPage) {
34+
return
35+
}
36+
37+
router.push('/blog')
38+
}, [pageProps, router])
39+
2840
// Check for errors.
2941
const error = pageProps?.error
3042
let errorMessage = pageProps?.errorMessage ?? 'An unknown error occurred.'

vercel.json

Lines changed: 0 additions & 9 deletions
This file was deleted.

yarn.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4685,10 +4685,10 @@ commander@^6.0.0, commander@^6.2.0:
46854685
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
46864686
integrity sha512-zP4jEKbe8SHzKJYQmq8Y9gYjtO/POJLgIdKgV7B9qNmABVFVc+ctqSX6iXh4mCpJfRBOabiZ2YKPg8ciDw6C+Q==
46874687

4688-
4689-
version "1.1.0"
4690-
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.1.0.tgz#4f6fac17718363653e1cb6d5ded3f093ce51ae4e"
4691-
integrity sha512-Q4dQ9niTWOF01ufvH/z6Z3RsBkwr7G42IsaFjuNliL6CY9ZeOEU3jRwTNY2mTY1ibAsASMrXnlQtx2tOb7Q8MA==
4688+
4689+
version "1.1.1"
4690+
resolved "https://registry.yarnpkg.com/comment-parser/-/comment-parser-1.1.1.tgz#c0581d520677e2cfab1a568e94ea0400df9fe4bd"
4691+
integrity sha512-vue7cRi1ZO5/72FJ+wZ5+siTSBlUv3ZksTk8bWD2IkaA6obitzMZP3yI65azTJLckwmi8lxfPP5Sd9oGuZ8e2g==
46924692

46934693
commondir@^1.0.1:
46944694
version "1.0.1"
@@ -5906,10 +5906,10 @@ escodegen@^1.12.0:
59065906
optionalDependencies:
59075907
source-map "~0.6.1"
59085908

5909-
eslint-config-prettier@^7.1.0:
5910-
version "7.1.0"
5911-
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.1.0.tgz#5402eb559aa94b894effd6bddfa0b1ca051c858f"
5912-
integrity sha512-9sm5/PxaFG7qNJvJzTROMM1Bk1ozXVTKI0buKOyb0Bsr1hrwi0H/TzxF/COtf1uxikIK8SwhX7K6zg78jAzbeA==
5909+
eslint-config-prettier@^7.2.0:
5910+
version "7.2.0"
5911+
resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz#f4a4bd2832e810e8cc7c1411ec85b3e85c0c53f9"
5912+
integrity sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg==
59135913

59145914
eslint-import-resolver-node@^0.3.4:
59155915
version "0.3.4"
@@ -5946,12 +5946,12 @@ eslint-plugin-import@^2.22.1:
59465946
resolve "^1.17.0"
59475947
tsconfig-paths "^3.9.0"
59485948

5949-
eslint-plugin-jsdoc@^31.0.6:
5950-
version "31.0.6"
5951-
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-31.0.6.tgz#8e6b57ea74b2ac262b9d78b18ae472866571303c"
5952-
integrity sha512-wGd83EcR+M0HHBgVx3f4gf78z5gMyEil6fqebpAFPeG9fgbUcP1XiWikTWSW3rJrjj7rQvCud6A/IRFMFzanLQ==
5949+
eslint-plugin-jsdoc@^31.0.7:
5950+
version "31.0.7"
5951+
resolved "https://registry.yarnpkg.com/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-31.0.7.tgz#a3ed0c1060521374f5c413e5a4bb90ef2ab9a60a"
5952+
integrity sha512-aAfVrXxgS+x9nW97DYZ1hEdKvobSqfT6S9xIU+pZYZ9mQW03B4l6s79CcAz6Q/RqYJj/nq+IOQO5ZFA8v7e0Og==
59535953
dependencies:
5954-
comment-parser "1.1.0"
5954+
comment-parser "1.1.1"
59555955
debug "^4.3.1"
59565956
jsdoctypeparser "^9.0.0"
59575957
lodash "^4.17.20"

0 commit comments

Comments
 (0)