Restructure routes, add tests and make pathmap dynamic
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import guides from "data/guides";
|
||||
|
||||
export const getRequestedGuide = req => {
|
||||
const guide = guides.find(guide => guide.slug === req.url);
|
||||
const guide = guides.find(guide => guide.url === req.url);
|
||||
if (!guide) {
|
||||
return null;
|
||||
}
|
||||
@@ -9,7 +9,7 @@ export const getRequestedGuide = req => {
|
||||
// We will use this URL format to find the relevant markdown
|
||||
// file inside the `/data` directory. For example `/guides/learn-regex`
|
||||
// has to have `/guides/learn-regex.md` file inside the `data` directory
|
||||
const path = guide.slug.replace(/^\//, '');
|
||||
const path = guide.url.replace(/^\//, '');
|
||||
|
||||
try {
|
||||
return {
|
||||
|
Reference in New Issue
Block a user