Add gtag and fix icons height

This commit is contained in:
Kamran Ahmed
2019-11-08 01:32:01 +04:00
parent 565da5548b
commit 21b715dc57
10 changed files with 76 additions and 37 deletions

View File

@@ -2,23 +2,16 @@ import guides from "data/guides";
import authors from "data/authors";
import siteConfig from "data/site";
export const getRequestedGuide = req => {
const guide = guides.find(guide => guide.url === req.url);
if (!guide) {
return null;
}
// 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.url.replace(/^\//, '');
try {
return {
...guide,
author: authors.find(author => author.username === guide.author) || {},
component: require(`../data/${path}.md`).default,
};
} catch (e) {
console.log(e);