File tree Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Expand file tree Collapse file tree 1 file changed +83
-0
lines changed Original file line number Diff line number Diff line change
1
+ # gatsby-transformer-yaml-netlify
2
+
3
+ Parses YAML files. Supports a data layout that is compatible with netlify-cms.
4
+
5
+ ## Install
6
+
7
+ ` npm install --save gatsby-transformer-yaml-netlify `
8
+
9
+ ## How to use
10
+
11
+ ``` javascript
12
+ // In your gatsby-config.js
13
+ plugins: [
14
+ ` gatsby-transformer-yaml-netlify` ,
15
+ ]
16
+ ```
17
+
18
+ ## Parsing algorithm
19
+
20
+ If you have a data layout like so:
21
+
22
+ ```
23
+ data/
24
+ takers/
25
+ a-taker.yml // value: a
26
+ b-taker.yml // value: b
27
+ leavers/
28
+ a-leaver.yml // value: a
29
+ b-leaver.yml // value: b
30
+ ```
31
+
32
+ Then four nodes will be created:
33
+
34
+ ``` javascript
35
+ [
36
+ {
37
+ value: ' a' ,
38
+ type: ' TakersYaml'
39
+ },
40
+ {
41
+ value: ' b' ,
42
+ type: ' TakersYaml'
43
+ },
44
+ {
45
+ value: ' a' ,
46
+ type: ' LeaversYaml'
47
+ },
48
+ {
49
+ value: ' b' ,
50
+ type: ' LeaversYaml'
51
+ }
52
+ ]
53
+ ```
54
+
55
+ ## How to query
56
+
57
+ You'd be able to query your takers like:
58
+
59
+ ``` graphql
60
+ {
61
+ allTakersYaml {
62
+ edges {
63
+ node {
64
+ value
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ And your leavers like:
72
+
73
+ ``` graphql
74
+ {
75
+ allLeaversYaml {
76
+ edges {
77
+ node {
78
+ value
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
You can’t perform that action at this time.
0 commit comments