Skip to content

Commit 018bd67

Browse files
author
Alban Bailly
committed
better paths
1 parent 6b2dc46 commit 018bd67

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

gatsby-node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ exports.createPages = async ({ actions, graphql }) => {
133133
paths = _.uniq(paths);
134134
paths.forEach(name => {
135135
createPage({
136-
path: `api/v4${name}`,
136+
path: `api/v4/${_.kebabCase(name)}`,
137137
component: apiTemplate,
138138
context: {
139139
name

src/components/2_molecules/sidemenu.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from "react";
22
import { graphql, StaticQuery } from "gatsby";
33

4+
const _ = require("lodash");
5+
46
const SideMenu = ({ data }) => {
57
const groups = data.allPaths.group;
68

@@ -16,17 +18,23 @@ const SideMenu = ({ data }) => {
1618
<div key={i}>
1719
{n.get && (
1820
<li className="list-reset">
19-
<a href={`/api/v4${n.name}#get`}>{n.get.summary}</a>
21+
<a href={`/api/v4/${_.kebabCase(n.name)}#get`}>
22+
{n.get.summary}
23+
</a>
2024
</li>
2125
)}
2226
{n.post && (
2327
<li className="list-reset">
24-
<a href={`/api/v4${n.name}#post`}>{n.post.summary}</a>
28+
<a href={`/api/v4/${_.kebabCase(n.name)}#post`}>
29+
{n.post.summary}
30+
</a>
2531
</li>
2632
)}
2733
{n.put && (
2834
<li className="list-reset">
29-
<a href={`/api/v4${n.name}#put`}>{n.put.summary}</a>
35+
<a href={`/api/v4/${_.kebabCase(n.name)}#put`}>
36+
{n.put.summary}
37+
</a>
3038
</li>
3139
)}
3240
</div>

src/components/5_templates/api.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const apiPage = ({ data }) => {
5555
</p>
5656
<ul>
5757
{r.content &&
58+
r.content.application_json &&
5859
Object.keys(
5960
r.content.application_json.schema.properties
6061
).map((p, i) => {

0 commit comments

Comments
 (0)