Skip to content

Commit

Permalink
Migrate to Gatsby v2 🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
v4iv committed Nov 28, 2018
1 parent 7667c01 commit 6ba56ed
Show file tree
Hide file tree
Showing 49 changed files with 8,260 additions and 23,260 deletions.
8 changes: 6 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"parser": "babel-eslint",
"extends": ["standard", "standard-trailing-commas", "standard-react"],
"extends": [
"standard",
"standard-trailing-commas",
"standard-react"
],
"globals": {
"graphql": true,
"__PATH_PREFIX__": true
Expand All @@ -9,4 +13,4 @@
"react/prop-types": "off",
"camelcase": "off"
}
}
}
78 changes: 9 additions & 69 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,83 +51,23 @@ typings/
# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# gatsby files
.cache/
public
yarn-error.log
### Node template
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
# Mac files
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# idea
#IDE
.idea/

.cache/
# Build directory
public/
static/admin/*.bundle.*
.DS_Store
.vscode/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 gatsbyjs
Copyright (c) 2018 Vaibhav Sharma

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# gatsby-starter-business
A [Gatsby](https://www.gatsbyjs.org/) and [Netlify CMS](https://www.netlifycms.org) powered generic business website starter based on [gatsby-starter-netlify-cms](https://github.com/AustinGreen/gatsby-starter-netlify-cms).
A [Gatsby v2](https://www.gatsbyjs.org/) and [Netlify CMS](https://www.netlifycms.org) powered generic business website starter based on [gatsby-starter-netlify-cms](https://github.com/AustinGreen/gatsby-starter-netlify-cms).

It follows the [JAMstack architecture](https://jamstack.org) by using Git as a single source of truth, and [Netlify](https://www.netlify.com) for continuous deployment, and CDN distribution.

Expand All @@ -14,7 +14,12 @@ It follows the [JAMstack architecture](https://jamstack.org) by using Git as a s
* Progressive Web App & Offline Support
* Tags and RSS Feed for Blog
* Disqus and Share Support
* Elastic-Lunr Search (NEW)
* Pagination (NEW)
* Easy Configuration using `config.js` file

## Deployment
<a href="https://app.netlify.com/start/deploy?repository=https://github.com/v4iv/gatsby-starter-business&amp;stack=cms"><img src="https://www.netlify.com/img/deploy/button.svg" alt="Deploy to Netlify"></a>

## TODO
- Pagination for Blog (gatsby-paginate)
- Search (@andrew-codes/gatsby-plugin-elasticlunr-search)
* Improve `README.md` (PRs are always welcome)
3 changes: 0 additions & 3 deletions meta/config.js → data/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/**
* Created by vaibhav on 31/3/18
*/
module.exports = {
siteTitle: 'Gatsby Starter Business', // Site title.
siteTitleAlt: 'Business', // Alternative site title for SEO.
Expand Down
140 changes: 89 additions & 51 deletions gatsby-config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
/**
* Created by vaibhav on 31/3/18
*/
const config = require('./meta/config')
const config = require('./data/config')

const pathPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix

Expand All @@ -22,6 +19,14 @@ module.exports = {
plugins: [
'gatsby-plugin-react-helmet',
'gatsby-plugin-sass',
{
// keep as first gatsby-source-filesystem plugin for gatsby image support
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/assets/img`,
name: 'uploads',
},
},
{
resolve: 'gatsby-source-filesystem',
options: {
Expand All @@ -35,7 +40,7 @@ module.exports = {
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/img`,
path: `${__dirname}/src/assets/img`,
name: 'images',
},
},
Expand All @@ -44,22 +49,38 @@ module.exports = {
{
resolve: 'gatsby-transformer-remark',
options: {
plugins: [],
plugins: [
{
resolve: 'gatsby-remark-relative-images',
options: {
name: 'uploads',
},
},
{
resolve: 'gatsby-remark-images',
options: {
// It's important to specify the maxWidth (in pixels) of
// the content container as this plugin uses this as the
// base for generating different widths of each image.
maxWidth: 2048,
},
},
],
},
},
`gatsby-plugin-layout`,
{
resolve: 'gatsby-plugin-netlify-cms',
options: {
modulePath: `${__dirname}/src/cms/cms.js`,
enableIdentityWidget: true,
htmlTitle: `TLCB Content Manager`,
},
},
`gatsby-plugin-offline`,
{
resolve: `gatsby-plugin-nprogress`,
options: {
// Setting a color is optional.
color: config.themeColor,
// Disable the loading spinner.
showSpinner: false,
},
},
Expand All @@ -75,7 +96,7 @@ module.exports = {
options: {
name: config.siteTitle,
short_name: config.siteTitleAlt,
start_url: '/',
start_url: '/index.html',
background_color: config.backgroundColor,
theme_color: config.themeColor,
display: 'standalone',
Expand All @@ -92,40 +113,42 @@ module.exports = {
},
],
},

},
`gatsby-plugin-offline`,
{
resolve: 'gatsby-plugin-feed',
options: {
setup (ref) {
const ret = ref.query.site.siteMetadata.rssMetadata
ret.allMarkdownRemark = ref.query.allMarkdownRemark
ret.generator = 'GatsbyJS Business Starter'
ret.generator = config.siteTitle
return ret
},
query: `
{
site {
siteMetadata {
rssMetadata {
site_url
feed_url
title
description
image_url
author
copyright
}
}
{
site {
siteMetadata {
rssMetadata {
site_url
feed_url
title
description
image_url
author
copyright
}
}
`,
}
}
`,
feeds: [
{
serialize (ctx) {
const rssMetadata = ctx.query.site.siteMetadata.rssMetadata
return ctx.query.allMarkdownRemark.edges
.filter(edge => edge.node.frontmatter.templateKey === 'article-page')
.filter(
edge => edge.node.frontmatter.templateKey === 'article-page'
)
.map(edge => ({
categories: edge.node.frontmatter.tags,
date: edge.node.frontmatter.date,
Expand All @@ -138,35 +161,50 @@ module.exports = {
}))
},
query: `
{
allMarkdownRemark(
limit: 1000,
sort: { order: DESC, fields: [frontmatter___date] },
) {
edges {
node {
excerpt(pruneLength: 400)
html
id
fields { slug }
frontmatter {
title
templateKey
cover
date(formatString: "MMMM DD, YYYY")
tags
}
}
}
}
{
allMarkdownRemark(
limit: 1000,
sort: { order: DESC, fields: [frontmatter___date] },
) {
edges {
node {
excerpt(pruneLength: 400)
html
id
fields { slug }
frontmatter {
title
templateKey
cover
date(formatString: "MMMM DD, YYYY")
tags
}
`,
}
}
}
}
`,
output: config.siteRss,
},
],
},
},
'gatsby-plugin-netlify',
{
resolve: `@gatsby-contrib/gatsby-plugin-elasticlunr-search`,
options: {
// Fields to index
fields: [`title`, `tags`],
// How to resolve each field`s value for a supported node type
resolvers: {
// For any node of type MarkdownRemark, list how to resolve the fields` values
MarkdownRemark: {
title: node => node.frontmatter.title,
tags: node => node.frontmatter.tags,
slug: node => node.fields.slug,
},
},
},
},
`gatsby-plugin-netlify`,
],
}

Loading

0 comments on commit 6ba56ed

Please sign in to comment.