Skip to content
This repository was archived by the owner on Apr 21, 2026. It is now read-only.

Commit b977f6c

Browse files
authored
Merge pull request #16 from secureCodeBox/feature/rework-navigation
Feature/rework navigation
2 parents a2a8801 + d8b7ade commit b977f6c

30 files changed

Lines changed: 2150 additions & 657 deletions

gatsby-config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,11 @@ module.exports = {
1414
phone: "+49 89 614551-0",
1515
email: "security@iteratec.com",
1616
},
17-
// TODO: replace links with actual pages here and link the correct reference in Menu.js
1817
menuLinks: [
1918
{
20-
name: "Get Started",
21-
external: true,
22-
// link: '/getStarted',
23-
link: "https://github.com/secureCodeBox/secureCodeBox-v2-alpha",
24-
},
25-
{
26-
name: "Docs",
27-
external: true,
28-
// link: '/docs',
29-
link:
30-
"https://github.com/secureCodeBox/secureCodeBox-v2-alpha/blob/master/docs/index.md",
19+
name: 'Get Started',
20+
external: false,
21+
link: '/getStarted',
3122
},
3223
{
3324
name: "Integrations",
@@ -38,6 +29,8 @@ module.exports = {
3829
},
3930

4031
plugins: [
32+
`gatsby-plugin-sharp`,
33+
`gatsby-transformer-sharp`,
4134
`gatsby-plugin-emotion`,
4235
`gatsby-plugin-sass`,
4336
{
@@ -132,5 +125,12 @@ module.exports = {
132125
path: `${__dirname}/.cache/gatsby-source-git/secureCodeBox-v2-alpha/hooks`,
133126
},
134127
},
128+
{
129+
resolve: `gatsby-source-filesystem`,
130+
options: {
131+
name: `docs`,
132+
path: `${__dirname}/.cache/gatsby-source-git/secureCodeBox-v2-alpha/docs`,
133+
},
134+
},
135135
],
136136
};

gatsby-node.js

Lines changed: 33 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const path = require("path");
2-
const fs = require("fs");
1+
const path = require('path');
2+
const fs = require('fs');
33

44
// Create pages from markdown files
55
exports.createPages = ({ graphql, actions }) => {
@@ -8,37 +8,7 @@ exports.createPages = ({ graphql, actions }) => {
88
resolve(
99
graphql(`
1010
{
11-
getStarted: allMarkdownRemark(
12-
filter: { fileAbsolutePath: { regex: "/getStarted/" } }
13-
sort: { fields: [frontmatter___date], order: DESC }
14-
) {
15-
edges {
16-
node {
17-
id
18-
frontmatter {
19-
path
20-
title
21-
}
22-
excerpt
23-
}
24-
}
25-
}
26-
docs: allMarkdownRemark(
27-
filter: { fileAbsolutePath: { regex: "/docs/" } }
28-
sort: { fields: [frontmatter___date], order: DESC }
29-
) {
30-
edges {
31-
node {
32-
id
33-
frontmatter {
34-
path
35-
title
36-
}
37-
excerpt
38-
}
39-
}
40-
}
41-
scanner: allMarkdownRemark(
11+
git: allMarkdownRemark(
4212
filter: { fileAbsolutePath: { regex: "/gatsby-source-git/" } }
4313
) {
4414
edges {
@@ -53,79 +23,42 @@ exports.createPages = ({ graphql, actions }) => {
5323
}
5424
}
5525
}
56-
persistenceProvider: allMarkdownRemark(
57-
filter: {
58-
fileAbsolutePath: { regex: "/integrations/persistence-provider/" }
59-
}
60-
) {
61-
edges {
62-
node {
63-
frontmatter {
64-
title
65-
path
66-
category
67-
}
68-
id
69-
}
70-
}
71-
}
7226
}
7327
`).then((result) => {
74-
result.data.getStarted.edges.forEach(({ node }) => {
75-
const component = path.resolve("src/templates/getStarted.js");
76-
createPage({
77-
path: node.frontmatter.path,
78-
component,
79-
context: {
80-
id: node.id,
81-
},
82-
});
83-
});
84-
result.data.docs.edges.forEach(({ node }) => {
85-
const component = path.resolve("src/templates/docs.js");
86-
createPage({
87-
path: node.frontmatter.path,
88-
component,
89-
context: {
90-
id: node.id,
91-
},
92-
});
93-
});
94-
result.data.scanner.edges.forEach(({ node }) => {
95-
const component = path.resolve("src/templates/integration.js");
96-
97-
let componentName = "";
28+
result.data.git.edges.forEach(({ node }) => {
29+
let componentName = '';
9830
if (node.frontmatter.path) {
9931
// The path consists normally like "scanners/nmap" or "hook/persistence-elastic"
100-
componentName = node.frontmatter.path.split("/")[1];
32+
componentName = node.frontmatter.path.split('/')[1];
10133
}
10234

103-
createPage({
104-
path: `integrations/${node.frontmatter.path}`,
105-
component,
106-
context: {
107-
id: node.id,
108-
exampleFilter: `/${componentName}/examples/`,
109-
},
110-
});
111-
});
112-
result.data.persistenceProvider.edges.forEach(({ node }) => {
113-
const component = path.resolve("src/templates/integration.js");
114-
115-
let componentName = "";
116-
if (node.frontmatter.path) {
117-
// The path consists normally like "scanners/nmap" or "hook/persistence-elastic"
118-
componentName = node.frontmatter.path.split("/")[1];
35+
if (
36+
node.frontmatter.category === 'scanner' ||
37+
node.frontmatter.category === 'hook'
38+
) {
39+
const component = path.resolve('src/templates/integration.js');
40+
createPage({
41+
path: `integrations/${node.frontmatter.path}`,
42+
component,
43+
context: {
44+
id: node.id,
45+
exampleFilter: `/${componentName}/examples/`,
46+
},
47+
});
48+
} else if (
49+
node.frontmatter.category === 'develop' ||
50+
node.frontmatter.category === 'use'
51+
) {
52+
const component = path.resolve('src/templates/doc.js');
53+
createPage({
54+
path: `getStarted/${node.frontmatter.path}`,
55+
component,
56+
context: {
57+
id: node.id,
58+
exampleFilter: `/${componentName}/examples/`,
59+
},
60+
});
11961
}
120-
121-
createPage({
122-
path: `integrations/${node.frontmatter.path}`,
123-
component,
124-
context: {
125-
id: node.id,
126-
exampleFilter: `/${componentName}/examples/`,
127-
},
128-
});
12962
});
13063
resolve();
13164
})
@@ -147,7 +80,7 @@ exports.onCreateNode = ({ node, actions }) => {
14780
createNodeField({
14881
node,
14982
name: `scanTarget`,
150-
value: node.relativeDirectory.split("/examples/")[1],
83+
value: node.relativeDirectory.split('/examples/')[1],
15184
});
15285
}
15386
};

0 commit comments

Comments
 (0)