This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-29
lines changed Expand file tree Collapse file tree 1 file changed +24
-29
lines changed Original file line number Diff line number Diff line change
1
+ import globalPostFields from '../_partials/globalPostFields'
2
+ import seoPostFields from '../_partials/seoPostFields'
3
+ import authorPostFields from '../_partials/authorPostFields'
4
+ import featuredImagePostFields from '../_partials/featuredImagePostFields'
5
+
1
6
const { gql} = require ( '@apollo/client' )
2
7
8
+ // Fragment: retrieve single page fields.
9
+ const singlePageFragment = gql `
10
+ fragment SinglePageFields on Page {
11
+ ${ globalPostFields }
12
+ blocksJSON
13
+ excerpt
14
+ ${ seoPostFields }
15
+ ${ authorPostFields }
16
+ ${ featuredImagePostFields }
17
+ }
18
+ `
19
+
3
20
// Query: retrieve page by specified identifier.
4
21
const queryPageById = gql `
5
- query GET_PAGE_BY_SLUG($id: ID!, $idType: PageIdType = URI) {
22
+ query GET_PAGE_BY_SLUG(
23
+ $id: ID!
24
+ $idType: PageIdType = URI
25
+ $imageSize: MediaItemSizeEnum = LARGE
26
+ ) {
6
27
page(id: $id, idType: $idType) {
7
- blocksJSON
8
- databaseId
9
- date
10
- slug
11
- title
12
- excerpt
13
- seo {
14
- canonical
15
- title
16
- metaDesc
17
- metaRobotsNofollow
18
- metaRobotsNoindex
19
- opengraphImage {
20
- sourceUrl
21
- }
22
- }
23
- author {
24
- node {
25
- slug
26
- nickname
27
- }
28
- }
29
- featuredImage {
30
- node {
31
- altText
32
- sourceUrl(size: LARGE)
33
- }
34
- }
28
+ ...SinglePageFields
35
29
}
36
30
}
31
+ ${ singlePageFragment }
37
32
`
38
33
39
34
export default queryPageById
You can’t perform that action at this time.
0 commit comments