rickvanlieshout.com/gatsby-config.js

204 lines
5.2 KiB
JavaScript
Raw Normal View History

const config = require("./content/config.json");
2018-11-09 18:08:48 +01:00
2017-08-20 13:43:49 +02:00
module.exports = {
pathPrefix: config.pathPrefix,
2017-08-20 13:43:49 +02:00
siteMetadata: {
url: config.url,
title: config.title,
subtitle: config.subtitle,
copyright: config.copyright,
disqusShortname: config.disqusShortname,
postsPerPage: config.postsPerPage,
menu: config.menu,
author: config.author,
2017-08-20 13:43:49 +02:00
},
plugins: [
{
resolve: "gatsby-source-filesystem",
2019-07-19 19:42:20 +02:00
options: {
path: `${__dirname}/content`,
name: "content",
},
2018-11-09 20:20:44 +01:00
},
2017-08-20 13:43:49 +02:00
{
resolve: "gatsby-plugin-feed",
2017-08-20 13:43:49 +02:00
options: {
query: `
{
site {
siteMetadata {
url
2017-08-20 13:43:49 +02:00
title
subtitle
2017-08-20 13:43:49 +02:00
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) =>
allMarkdownRemark.edges.map(edge => ({
...edge.node.frontmatter,
description: edge.node.frontmatter.description,
date: edge.node.frontmatter.date,
url: site.siteMetadata.url + edge.node.fields.slug,
guid: site.siteMetadata.url + edge.node.fields.slug,
custom_elements: [{ "content:encoded": edge.node.html }],
})),
query: `
2017-08-20 13:43:49 +02:00
{
allMarkdownRemark(
limit: 1000,
sort: { order: DESC, fields: [frontmatter___date] },
2018-11-11 17:43:29 +01:00
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
2017-08-20 13:43:49 +02:00
) {
edges {
node {
html
fields {
slug
}
frontmatter {
title
date
2018-11-11 17:43:29 +01:00
template
2017-08-20 13:43:49 +02:00
draft
description
}
}
}
}
}
`,
output: "/rss.xml",
title: config.title,
},
],
},
2017-08-20 13:43:49 +02:00
},
{
resolve: "gatsby-transformer-remark",
2017-08-20 13:43:49 +02:00
options: {
plugins: [
{
resolve: "gatsby-remark-images",
options: {
maxWidth: 960,
withWebp: true,
},
2017-08-20 13:43:49 +02:00
},
{
resolve: "gatsby-remark-responsive-iframe",
options: { wrapperStyle: "margin-bottom: 1.0725rem" },
2017-08-20 13:43:49 +02:00
},
"gatsby-remark-autolink-headers",
"gatsby-remark-prismjs",
"gatsby-remark-copy-linked-files",
"gatsby-remark-smartypants",
"gatsby-remark-external-links",
],
},
2018-01-21 16:54:33 +01:00
},
"gatsby-transformer-sharp",
"gatsby-plugin-sharp",
2018-11-09 18:08:48 +01:00
{
resolve: "gatsby-plugin-google-gtag",
options: {
trackingIds: [config.googleAnalyticsId],
pluginConfig: {
head: true,
},
},
2018-11-09 18:08:48 +01:00
},
2017-08-20 13:43:49 +02:00
{
resolve: "gatsby-plugin-sitemap",
2017-08-20 13:43:49 +02:00
options: {
query: `
2018-11-09 18:08:48 +01:00
{
site {
siteMetadata {
2019-05-10 02:52:30 +02:00
siteUrl: url
2017-08-20 13:43:49 +02:00
}
2018-11-09 18:08:48 +01:00
}
allSitePage(
filter: {
path: { regex: "/^(?!/404/|/404.html|/dev-404-page/)/" }
}
) {
edges {
node {
path
2017-08-20 13:43:49 +02:00
}
}
2018-11-09 18:08:48 +01:00
}
}
`,
output: "/sitemap.xml",
serialize: ({ site, allSitePage }) =>
allSitePage.edges.map(edge => ({
url: site.siteMetadata.siteUrl + edge.node.path,
changefreq: "daily",
priority: 0.7,
})),
},
2017-08-20 13:43:49 +02:00
},
{
resolve: "gatsby-plugin-manifest",
options: {
name: config.title,
short_name: config.title,
start_url: "/",
background_color: "#FFF",
theme_color: "#F7A046",
display: "standalone",
icon: "content/photo.jpg",
},
},
2020-12-02 19:27:43 +01:00
{
resolve: "gatsby-plugin-offline",
2020-12-02 19:27:43 +01:00
options: {
workboxConfig: {
runtimeCaching: [
{
urlPattern: /(\.js$|\.css$|[^:]static\/)/,
handler: "CacheFirst",
},
{
urlPattern: /^https?:.*\/page-data\/.*\.json/,
handler: "StaleWhileRevalidate",
},
{
urlPattern:
/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
handler: "StaleWhileRevalidate",
},
{
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
handler: "StaleWhileRevalidate",
},
2020-12-02 19:27:43 +01:00
],
},
},
},
"gatsby-plugin-catch-links",
"gatsby-plugin-react-helmet",
2018-11-09 18:08:48 +01:00
{
resolve: "gatsby-plugin-sass",
2018-11-09 18:08:48 +01:00
options: {
implementation: require("sass"),
2018-11-09 18:08:48 +01:00
cssLoaderOptions: {
camelCase: false,
},
},
2019-04-08 17:53:56 +02:00
},
{
resolve: "@sentry/gatsby",
options: {
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1,
},
},
"gatsby-plugin-optimize-svgs",
],
2017-08-20 13:43:49 +02:00
};