質問編集履歴
3
修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -118,7 +118,7 @@
|
|
118
118
|
|
119
119
|
categories: [Array],
|
120
120
|
|
121
|
-
tags:
|
121
|
+
tags: { name: 'WordPress', slug: 'wordpress' },
|
122
122
|
|
123
123
|
featured_media: null } },
|
124
124
|
|
2
allPost, allTags追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -61,3 +61,121 @@
|
|
61
61
|
```
|
62
62
|
|
63
63
|
上記のように修正したところすべて`[]`になってしまいました。
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
### allPosts, allTags
|
68
|
+
|
69
|
+
#### allPosts
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
[ [Object: null prototype] {
|
76
|
+
|
77
|
+
node:
|
78
|
+
|
79
|
+
[Object: null prototype] {
|
80
|
+
|
81
|
+
wordpress_id: 2069,
|
82
|
+
|
83
|
+
date: '2014-01-05',
|
84
|
+
|
85
|
+
slug: 'verylong',
|
86
|
+
|
87
|
+
title:
|
88
|
+
|
89
|
+
'1行分しか想定されていない見出しのデザインだと文字がはみ出してしま
|
90
|
+
|
91
|
+
ってあら大変。ものすごく長い日本語のタイトルが付いた記事の表示テストです。
|
92
|
+
|
93
|
+
複数行になっても問題ないデザインだといいですね。あと前後の記事へのリンクを
|
94
|
+
|
95
|
+
出力している場合や、パンくずリストを実装している場合なども表示にズレがない
|
96
|
+
|
97
|
+
か確認しておきましょう。',
|
98
|
+
|
99
|
+
categories: [Array],
|
100
|
+
|
101
|
+
tags: null,
|
102
|
+
|
103
|
+
featured_media: null } },
|
104
|
+
|
105
|
+
[Object: null prototype] {
|
106
|
+
|
107
|
+
node:
|
108
|
+
|
109
|
+
[Object: null prototype] {
|
110
|
+
|
111
|
+
wordpress_id: 1178,
|
112
|
+
|
113
|
+
date: '2013-01-12',
|
114
|
+
|
115
|
+
slug: 'markup-html-tags-and-formatting',
|
116
|
+
|
117
|
+
title: 'マークアップ: HTML タグとフォーマット',
|
118
|
+
|
119
|
+
categories: [Array],
|
120
|
+
|
121
|
+
tags: [Array],
|
122
|
+
|
123
|
+
featured_media: null } },
|
124
|
+
|
125
|
+
[Object: null prototype] {
|
126
|
+
|
127
|
+
```
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
#### allTags
|
132
|
+
|
133
|
+
```
|
134
|
+
|
135
|
+
[ [Object: null prototype] {
|
136
|
+
|
137
|
+
wordpress_id: 77, name: '8ビット', slug: '8bit' },
|
138
|
+
|
139
|
+
[Object: null prototype] { wordpress_id: 78, name: 'aside', slug: 'aside'
|
140
|
+
|
141
|
+
},
|
142
|
+
|
143
|
+
[Object: null prototype] { wordpress_id: 79, name: 'Codex', slug: 'codex'
|
144
|
+
|
145
|
+
},
|
146
|
+
|
147
|
+
[Object: null prototype] { wordpress_id: 80, name: 'css', slug: 'css' },
|
148
|
+
|
149
|
+
[Object: null prototype] { wordpress_id: 81, name: 'FTW', slug: 'ftw' },
|
150
|
+
|
151
|
+
[Object: null prototype] { wordpress_id: 82, name: 'html', slug: 'html'
|
152
|
+
|
153
|
+
},
|
154
|
+
|
155
|
+
[Object: null prototype] { wordpress_id: 83, name: 'jetpack', slug:
|
156
|
+
|
157
|
+
'jetpack' },
|
158
|
+
|
159
|
+
[Object: null prototype] { wordpress_id: 2, name: 'test', slug: 'test' },
|
160
|
+
|
161
|
+
[Object: null prototype] { wordpress_id: 84, name: 'twitter', slug:
|
162
|
+
|
163
|
+
'twitter' },
|
164
|
+
|
165
|
+
[Object: null prototype] { wordpress_id: 85, name: 'videopress', slug:
|
166
|
+
|
167
|
+
'videopress' },
|
168
|
+
|
169
|
+
[Object: null prototype] {
|
170
|
+
|
171
|
+
wordpress_id: 86,
|
172
|
+
|
173
|
+
name: 'Webアプリケーション',
|
174
|
+
|
175
|
+
slug:
|
176
|
+
|
177
|
+
'web%e3%82%a2%e3%83%97%e3%83%aa%e3%82%b1%e3%83%bc%e3%82%b7%e3%83%a7%e3
|
178
|
+
|
179
|
+
%83%b3' },
|
180
|
+
|
181
|
+
```
|
1
追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -35,3 +35,29 @@
|
|
35
35
|
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
### 修正コード追記
|
44
|
+
|
45
|
+
```
|
46
|
+
|
47
|
+
allTags.forEach(tag => {
|
48
|
+
|
49
|
+
const tagPosts = allPosts.filter(edge =>
|
50
|
+
|
51
|
+
(edge.node.tags || []).filter(post_tag => post_tag.wordpress_id === tag.wordpress_id).length
|
52
|
+
|
53
|
+
);
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
console.log(tagPosts)
|
58
|
+
|
59
|
+
})
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
上記のように修正したところすべて`[]`になってしまいました。
|