Skip to content

Commit 1ba5eba

Browse files
authored
Filter case studies by publishLocation prop (#49)
1 parent 2d4ee90 commit 1ba5eba

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

gatsby-node.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ exports.createPages = async ({ actions, graphql }) => {
4444

4545
const result = await graphql(`
4646
{
47-
caseStudies: allContentfulCaseStudy(sort: { datePublished: DESC }) {
47+
caseStudies: allContentfulCaseStudy(
48+
sort: { datePublished: DESC }
49+
filter: {
50+
publishLocation: {
51+
elemMatch: {
52+
urlLocation: { eq: "https://sdv.dev/community-case-studies/" }
53+
}
54+
}
55+
}
56+
) {
4857
edges {
4958
node {
5059
url

src/components/community-stats/CommunityUsersSection.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,16 @@ export default function CommunityUsersSection() {
66

77
const data = useStaticQuery(graphql`
88
query {
9-
caseStudies: allContentfulCaseStudy(sort: { datePublished: DESC }) {
9+
caseStudies: allContentfulCaseStudy(
10+
sort: { datePublished: DESC }
11+
filter: {
12+
publishLocation: {
13+
elemMatch: {
14+
urlLocation: { eq: "https://sdv.dev/community-case-studies/" }
15+
}
16+
}
17+
}
18+
) {
1019
edges {
1120
node {
1221
url

0 commit comments

Comments
 (0)