1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-06-17 01:53:13 +02:00
blog/gatsby-config.js

119 lines
3.3 KiB
JavaScript
Raw Normal View History

2018-07-11 17:56:13 +02:00
const path = require('path')
const fs = require('fs')
const yaml = require('js-yaml')
const meta = yaml.load(fs.readFileSync('./content/meta.yml', 'utf8'))
const { url } = meta
2018-08-30 17:23:55 +02:00
// required for gatsby-plugin-meta-redirect
require('regenerator-runtime/runtime')
2018-07-11 17:56:13 +02:00
module.exports = {
siteMetadata: {
siteUrl: `${url}`
},
plugins: [
2018-07-17 23:33:55 +02:00
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'posts',
path: path.join(__dirname, 'content', 'posts')
}
},
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'media',
path: path.join(__dirname, 'content', 'media')
}
},
2018-07-18 00:24:11 +02:00
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'posts',
path: path.join(__dirname, 'content')
}
},
2018-08-11 02:39:18 +02:00
{
resolve: 'gatsby-source-filesystem',
options: {
name: 'images',
path: path.join(__dirname, 'src', 'images')
}
},
2018-07-11 17:56:13 +02:00
{
resolve: 'gatsby-transformer-remark',
options: {
2018-07-19 23:04:41 +02:00
excerpt_separator: '<!-- more -->',
2018-07-11 17:56:13 +02:00
plugins: [
{
resolve: 'gatsby-remark-images',
options: {
2018-07-17 23:33:55 +02:00
maxWidth: 940,
linkImagesToOriginal: false,
2018-07-20 15:23:57 +02:00
// sizeByPixelDensity: true,
2018-07-18 00:24:11 +02:00
showCaptions: true,
2018-07-18 02:19:32 +02:00
backgroundColor: '#dfe8ef'
2018-07-11 17:56:13 +02:00
}
},
2018-07-19 23:04:41 +02:00
{
resolve: 'gatsby-remark-copy-linked-files',
options: {
destinationDir: 'media'
}
},
2018-07-18 02:19:32 +02:00
'gatsby-remark-prismjs',
2018-07-17 23:33:55 +02:00
'gatsby-remark-smartypants',
'gatsby-remark-autolink-headers'
2018-07-11 17:56:13 +02:00
]
}
},
{
resolve: 'gatsby-plugin-sass',
options: {
2018-07-18 00:24:11 +02:00
includePaths: [`${__dirname}/node_modules`, `${__dirname}/src/styles`]
2018-07-11 17:56:13 +02:00
}
},
2018-08-28 23:28:42 +02:00
{
resolve: 'gatsby-plugin-lunr',
options: {
languages: [
{
// ISO 639-1 language codes. See https://lunrjs.com/guides/language_support.html for details
name: 'en'
}
],
// Fields to index. If store === true value will be stored in index file.
// Attributes for custom indexing logic. See https://lunrjs.com/docs/lunr.Builder.html for details
fields: [
{ name: 'title', store: true, attributes: { boost: 20 } },
{ name: 'content' },
{ name: 'excerpt', attributes: { boost: 10 } },
{ name: 'category', store: true, attributes: { boost: 5 } },
{ name: 'tags', store: true },
{ name: 'url', store: true }
],
// 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,
content: node => node.rawMarkdownBody,
excerpt: node => node.frontmatter.excerpt,
category: node => node.frontmatter.category,
tags: node => node.frontmatter.tags,
url: node => node.fields.slug
}
}
}
},
2018-07-17 23:33:55 +02:00
'gatsby-plugin-react-helmet',
'gatsby-transformer-yaml',
'gatsby-transformer-sharp',
'gatsby-plugin-sharp',
2018-07-19 23:04:41 +02:00
'gatsby-plugin-sitemap',
'gatsby-plugin-catch-links',
2018-08-30 17:23:55 +02:00
'gatsby-redirect-from',
'gatsby-plugin-meta-redirect'
2018-07-11 17:56:13 +02:00
]
}