1
|
|
|
import { graphql, Link } from "gatsby" |
2
|
|
|
import React from "react" |
3
|
|
|
import { CardTeaser } from "../components/Card" |
4
|
|
|
import { Seo } from "../components/Seo" |
5
|
|
|
import Layout from "../layouts" |
6
|
|
|
import { NewsTagPageQuery } from "../Types/Article" |
7
|
|
|
import "./NewsOverview.scss" |
8
|
|
|
|
9
|
|
|
const NewsTagPage = ({ data }: NewsTagPageQuery) => { |
10
|
|
|
const { articles, term, categoryTags } = data |
11
|
|
|
const pathUrl = term.path.alias |
12
|
|
|
|
13
|
|
|
return ( |
14
|
|
|
<Layout> |
15
|
|
|
<Seo title={term.name} path={pathUrl} /> |
16
|
|
|
|
17
|
|
|
<header className="page_header__wrapper"> |
18
|
|
|
<div className="page_header"> |
19
|
|
|
<h1>KCVV Elewijt - #{term.name}</h1> |
20
|
|
|
</div> |
21
|
|
|
</header> |
22
|
|
|
<div className="newsoverview__wrapper page__wrapper"> |
23
|
|
|
<section className={`archive__filter_wrapper`}> |
24
|
|
|
<h5>Filter op categorie</h5> |
25
|
|
|
<section className={`archive__filter_filters`}> |
26
|
|
|
<Link to={`/news/`} className={`btn btn--small`}> |
27
|
|
|
Alles |
28
|
|
|
</Link> |
29
|
|
|
{categoryTags.edges.map(({ node }) => ( |
30
|
|
|
<Link to={node.path.alias} className={`btn btn--small`} key={node.name}> |
31
|
|
|
{node.name} |
32
|
|
|
</Link> |
33
|
|
|
))} |
34
|
|
|
</section> |
35
|
|
|
</section> |
36
|
|
|
<main className={`newsoverview__content__wrapper newsoverview__content__wrapper--archive`}> |
37
|
|
|
{articles && |
38
|
|
|
articles.edges.map(({ node }) => ( |
39
|
|
|
<CardTeaser |
40
|
|
|
key={node.id} |
41
|
|
|
title={node.title} |
42
|
|
|
picture={ |
43
|
|
|
node.relationships.field_media_article_image.relationships.field_media_image.localFile.childImageSharp |
44
|
|
|
.gatsbyImageData |
45
|
|
|
} |
46
|
|
|
link={node.path.alias} |
47
|
|
|
tags={node.relationships?.field_tags} |
48
|
|
|
createTime={node.created} |
49
|
|
|
/> |
50
|
|
|
))} |
51
|
|
|
</main> |
52
|
|
|
</div> |
53
|
|
|
</Layout> |
54
|
|
|
) |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
export default NewsTagPage |
58
|
|
|
|
59
|
|
|
export const query = graphql` |
60
|
|
|
query ($slug: String!) { |
61
|
|
|
articles: allNodeArticle( |
62
|
|
|
sort: { fields: changed, order: DESC } |
63
|
|
|
limit: 20 |
64
|
|
|
filter: { relationships: { field_tags: { elemMatch: { path: { alias: { eq: $slug } } } } } } |
65
|
|
|
) { |
66
|
|
|
edges { |
67
|
|
|
node { |
68
|
|
|
created(formatString: "DD/MM/YYYY") |
69
|
|
|
changed(formatString: "DD/MM/YYYY") |
70
|
|
|
title |
71
|
|
|
body { |
72
|
|
|
summary |
73
|
|
|
} |
74
|
|
|
path { |
75
|
|
|
alias |
76
|
|
|
} |
77
|
|
|
relationships { |
78
|
|
|
field_media_article_image { |
79
|
|
|
...ArticleImage |
80
|
|
|
} |
81
|
|
|
field_tags { |
82
|
|
|
name |
83
|
|
|
path { |
84
|
|
|
alias |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
term: taxonomyTermCategory(path: { alias: { eq: $slug } }) { |
92
|
|
|
name |
93
|
|
|
path { |
94
|
|
|
alias |
95
|
|
|
} |
96
|
|
|
} |
97
|
|
|
categoryTags: allTaxonomyTermCategory( |
98
|
|
|
sort: { fields: name, order: ASC } |
99
|
|
|
filter: { |
100
|
|
|
status: { eq: true } |
101
|
|
|
relationships: { node__article: { elemMatch: { drupal_internal__nid: { gte: 1 } } } } |
102
|
|
|
} |
103
|
|
|
) { |
104
|
|
|
edges { |
105
|
|
|
node { |
106
|
|
|
path { |
107
|
|
|
alias |
108
|
|
|
} |
109
|
|
|
name |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
} |
114
|
|
|
` |
115
|
|
|
|