Skip to content

Commit 085eec4

Browse files
committed
Add iterator index to keep projects order
1 parent 4fb59f8 commit 085eec4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gridsome.server.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module.exports = function(api) {
77
api.loadSource(async actions => {
88
const contentTypeProjects = actions.addCollection("Project");
99

10-
for (const project of projects) {
11-
const randomId = crypto.randomBytes(12).toString('hex');
10+
for (const [index, project] of projects.entries()) {
11+
const randomId = crypto.randomBytes(12).toString("hex");
1212
try {
1313
await cw.file(project.url, `./src/assets/img/${randomId}.png`, {
1414
scaleFactor: 1,
@@ -20,6 +20,7 @@ module.exports = function(api) {
2020
}
2121

2222
contentTypeProjects.addNode({
23+
id: index,
2324
name: project.name,
2425
image: project.image,
2526
description: project.description,

0 commit comments

Comments
 (0)