@@ -67,28 +67,35 @@ export const createPages: GatsbyNode["createPages"] = async ({ actions, graphql
67
67
const createNewsPages = async ( { actions, graphql } : Pick < CreatePagesArgs , "actions" | "graphql" > ) => {
68
68
const { createPage } = actions
69
69
70
- const result = await graphql ( `{
71
- allMarkdownRemark(
72
- sort: {frontmatter: {date: DESC}}
73
- filter: {fields: {sourceName: {eq: "news"}}}
74
- ) {
75
- edges {
76
- node {
77
- id
78
- frontmatter {
79
- title
80
- date
81
- }
82
- html
83
- fields {
84
- slug
70
+ const result = await graphql ( `
71
+ {
72
+ allMarkdownRemark(
73
+ sort: { frontmatter: { date: DESC } }
74
+ filter: { fields: { sourceName: { in: ["news", "events"] } } }
75
+ ) {
76
+ edges {
77
+ node {
78
+ id
79
+ frontmatter {
80
+ title
81
+ date
82
+ show_as_news
83
+ }
84
+ html
85
+ fields {
86
+ slug
87
+ sourceName
88
+ }
89
+ }
85
90
}
86
91
}
87
92
}
88
- }
89
- }` )
93
+ ` )
90
94
91
- const edges = ( result . data as any ) . allMarkdownRemark . edges
95
+ const edges = ( result . data as any ) . allMarkdownRemark . edges . filter ( ( { node } ) =>
96
+ // we also want to show events that are marked with "show_as_news"
97
+ node . fields . sourceName === "events" ? ! ! node . frontmatter . show_as_news : true
98
+ )
92
99
93
100
createPaginatedPage ( {
94
101
edges : edges ,
@@ -112,26 +119,25 @@ const createNewsPages = async ({ actions, graphql }: Pick<CreatePagesArgs, "acti
112
119
113
120
const createEventPages = async ( { actions, graphql } : Pick < CreatePagesArgs , "actions" | "graphql" > ) => {
114
121
const { createPage } = actions
115
- const result = await graphql ( `{
116
- allMarkdownRemark(
117
- sort: {frontmatter: {date: DESC}}
118
- filter: {fields: {sourceName: {eq: "events"}}}
119
- ) {
120
- edges {
121
- node {
122
- id
123
- frontmatter {
124
- title
125
- date
126
- }
127
- html
128
- fields {
129
- slug
122
+ const result = await graphql ( `
123
+ {
124
+ allMarkdownRemark( sort: { frontmatter: { date: DESC } }, filter: { fields: { sourceName: { eq: "events" } } }) {
125
+ edges {
126
+ node {
127
+ id
128
+ frontmatter {
129
+ title
130
+ date
131
+ }
132
+ html
133
+ fields {
134
+ slug
135
+ }
136
+ }
130
137
}
131
138
}
132
139
}
133
- }
134
- }` )
140
+ ` )
135
141
136
142
const edges = ( result . data as any ) . allMarkdownRemark . edges
137
143
0 commit comments