- clone or fork repo
- run
yarn
from root - run
yarn dev
for development yarn test
for jest testingyarn lint
for lintingyarn stories
for storybook
deploy to netlify or vercel. use yarn build
Garden utilizes next.js prerendering in conjunction with next-mdx-remote to statically generate pages. You can extend the functionality by editing /pages/garden/[slug].js
and/or /utils/genGarden.js
. Here's how it works:
- In
/pages/garden/[slug].js
,getStaticPaths
passes the content folder specified in config togetAllPaths()
, which returns a list of routes. [slug].js
then callsgetAllPosts
ingetStaticProps
to get all data associated the mdx files. This includes the content, frontmatter (it handles formatting the date), and a list of mdx files that mention the current file (mentionedIn
). We userenderToString()
fromnext-mdx-remote
to get the mdx info.- This information is passed to the
GardenPost()
function, which usesnext-mdx-remote
'shydrate()
function to handle things on the client side.
Configuration is handled by src/config.js
. You can change these settings or add your own. By default, config handles the following:
export default {
/*
* title (string): title of site. used in SEO for opengraph.
*/
title: 'garden',
/*
* description (string): description of site. used in SEO for opengraph.
*/
description:
'opinionated, batteries included boilerplate for static blogging',
/*
* twitter (string): twitter handle. used in SEO for opengraph.
*/
twitter: '@speculative_dev',
/*
* favicon (string): path to favicon relative to /public folder.
*/
favicon: '/favicon.ico',
/*
* ogImage (string): path to opengraph image relative to /public folder. used in SEO for opengraph
*/
ogImage: '/ogImage.jpg',
/*
* url (string): site url. used in SEO for opengraph
*/
url: 'digital-garden.dev',
/*
* content (string): path to content directory folder from root. used in genGarden.js
*/
content: './src/garden',
/*
* menu (array): array of objects in shape of { label, href }. maps into navigation
*/
menu: [
{ label: 'garden', href: '/garden' },
{ label: 'about', href: '/about' }
]
};
The theme object lives in theme.js
. We use two ThemeProviders
-- one for styled-components and one for ThemeUI, the latter handles the markdown styles.
There are some defaults set at the top of the file, including fonts, breakpoints, colors, base font size, and line height. These feed into helper functions (found in themeHelper.js
) that return the final theme object.