fix: removed all guide bits from gatsby

This commit is contained in:
Mrugesh Mohapatra
2019-07-25 13:53:42 +05:30
committed by mrugesh
parent 7bc6367d68
commit 0124e7556d
27 changed files with 6 additions and 1493 deletions

View File

@ -1,47 +0,0 @@
const path = require('path');
const select = require('unist-util-select');
const { head } = require('lodash');
const { isAStubRE } = require('../regEx');
const guideArticle = path.resolve(
__dirname,
'../../src/templates/Guide/GuideArticle.js'
);
exports.createGuideArticlePages = createPage => ({
node: {
htmlAst,
excerpt,
fields: { slug, component },
id
}
}) => {
let meta = {};
if (!isAStubRE.test(excerpt)) {
const featureImage = head(select(htmlAst, 'element[tagName=img]'));
meta.featureImage = featureImage
? featureImage.properties.src
: 'https://s3.amazonaws.com/freecodecamp' +
'/freecodecamp-square-logo-large.jpg';
const description = head(select(htmlAst, 'element[tagName=p]'));
meta.description = description ? description.children[0].value : '';
}
return createPage({
path: `/guide${slug}`,
component: !component
? guideArticle
: path.resolve(
__dirname,
'../../src/templates/Guide/components/',
component
),
context: {
id,
meta
}
});
};

View File

@ -1,7 +1,5 @@
const challengePageCreators = require('./challengePageCreator');
const guidePageCreators = require('./guidePageCreator');
module.exports = {
...challengePageCreators,
...guidePageCreators
...challengePageCreators
};

View File

@ -3,11 +3,8 @@ import PropTypes from 'prop-types';
import {
CertificationLayout,
DefaultLayout,
GuideLayout
DefaultLayout
} from '../../src/components/layouts';
// eslint-disable-next-line max-len
import GuideNavMenu from '../../src/components/layouts/components/guide/NavMenu';
import FourOhFourPage from '../../src/pages/404';
export default function layoutSelector({ element, props }) {
@ -28,11 +25,7 @@ export default function layoutSelector({ element, props }) {
return <CertificationLayout>{element}</CertificationLayout>;
}
if (/^\/guide(\/.*)*/.test(pathname)) {
return (
<DefaultLayout navigationMenu={<GuideNavMenu />} pathname={pathname}>
<GuideLayout>{element}</GuideLayout>
</DefaultLayout>
);
console.log('Hitting guide for some reason. Need a redirect.');
}
if (/^\/learn(\/.*)*/.test(pathname)) {
return (