convert website from hugo to gatsby (#1369)

This commit is contained in:
Zeb Pykosz
2018-07-25 07:47:26 -04:00
committed by Shawn Erquhart
parent d6c03707d8
commit 04c44518b2
113 changed files with 7441 additions and 2771 deletions

View File

@ -0,0 +1,46 @@
import React from 'react';
import Helmet from 'react-helmet';
const BlogPost = ({ data }) => {
const { html, frontmatter } = data.markdownRemark;
const { author, title, date, description, meta_description } = frontmatter;
const desc = meta_description || description;
return (
<div className="docs page">
<Helmet>
<title>{title}</title>
{desc && <meta name="description" content={desc} />}
</Helmet>
<div className="container">
<article className="blog-content" id="blog-content">
<div className="blog-post-header">
<h1>{title}</h1>
<p className="meta-info">
by {author} on {date}
</p>
</div>
<div dangerouslySetInnerHTML={{ __html: html }} />
</article>
</div>
</div>
);
};
export default BlogPost;
export const pageQuery = graphql`
query blogPost($slug: String!) {
markdownRemark(fields: { slug: { eq: $slug } }) {
frontmatter {
title
description
# meta_description
date(formatString: "MMMM D, YYYY")
author
}
html
}
}
`;

View File

@ -0,0 +1,108 @@
import React from 'react';
import Helmet from 'react-helmet';
import { matchPath } from 'react-router-dom';
import EditLink from '../components/edit-link';
import Widgets from '../components/widgets';
import DocsNav from '../components/docs-nav';
import MobileNav from '../components/mobile-nav';
import '../css/lib/prism.css';
import '../css/imports/docs.css';
const toMenu = (menu, nav) =>
menu.map(group => ({
title: group.title,
group: nav.group.find(g => g.fieldValue === group.name)
}));
const DocPage = ({ data, location, history }) => {
const { nav, page, widgets, menu } = data;
const docsNav = toMenu(menu.siteMetadata.menu.docs, nav);
const showWidgets = matchPath(location.pathname, { path: '/docs/widgets' });
return (
<div className="docs detail page">
<Helmet title={page.frontmatter.title} />
<div className="container">
<aside id="sidebar" className="sidebar">
<DocsNav items={docsNav} location={location} />
<MobileNav items={docsNav} history={history} />
</aside>
<article className="docs-content" id="docs-content">
<EditLink path={page.fields.path} />
<h1>{page.frontmatter.title}</h1>
<div dangerouslySetInnerHTML={{ __html: page.html }} />
{showWidgets && <Widgets widgets={widgets} />}
</article>
</div>
</div>
);
};
export const pageQuery = graphql`
query docPage($slug: String!) {
page: markdownRemark(fields: { slug: { eq: $slug } }) {
fields {
path
}
frontmatter {
title
}
html
}
nav: allMarkdownRemark(
sort: { fields: [frontmatter___weight], order: ASC }
filter: {
frontmatter: { title: { ne: null }, group: { ne: null } }
fields: { slug: { regex: "/docs/" } }
}
) {
group(field: frontmatter___group) {
fieldValue
edges {
node {
fields {
slug
}
frontmatter {
title
group
}
tableOfContents
}
}
}
}
menu: site {
siteMetadata {
menu {
docs {
name
title
}
}
}
}
widgets: allMarkdownRemark(
sort: { fields: [frontmatter___label], order: ASC }
filter: {
frontmatter: { label: { ne: null } }
fields: { slug: { regex: "/widgets/" } }
}
) {
edges {
node {
frontmatter {
label
target
}
html
}
}
}
}
`;
export default DocPage;