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

Commit 238eb71

Browse files
committed
Add tag posts query
1 parent 4785f9f commit 238eb71

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

api/wordpress/tags/queryPostsByTag.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import {gql} from '@apollo/client'
2+
import defaultPageData from '../_partials/defaultPageData'
3+
import {archivePostFragment, archivePosts} from '../posts/queryPostsArchive'
4+
5+
// Query: retrieve posts tag archive.
6+
const queryPostsByTag = gql`
7+
query GET_POSTS_BY_TAG(
8+
$first: Int
9+
$last: Int
10+
$after: String
11+
$before: String
12+
$orderBy: PostObjectsConnectionOrderbyEnum = DATE
13+
$order: OrderEnum = DESC
14+
$imageSize: MediaItemSizeEnum = THUMBNAIL
15+
$id: ID!
16+
$idType: TagIdType = SLUG
17+
) {
18+
${defaultPageData}
19+
tag(id: $id, idType: $idType) {
20+
${archivePosts}
21+
}
22+
}
23+
${archivePostFragment}
24+
`
25+
26+
export default queryPostsByTag

0 commit comments

Comments
 (0)