diff --git a/.travis.yml b/.travis.yml
index 67c2eca4..6abe4d23 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,7 @@ install:
script:
- npm test
- - travis_wait 30 npm run build
+ - npm run build
after_success:
- pip install --user awscli
diff --git a/content/meta.yml b/content/meta.yml
index 708a32d4..5e4ec9e0 100644
--- a/content/meta.yml
+++ b/content/meta.yml
@@ -20,8 +20,8 @@ author:
github: https://github.com/kremalicious
facebook: https://facebook.com/matthiaskretschmann
googleplus: https://plus.google.com/+MatthiasKretschmann
- rss: https://kremalicious.com/feed.xml
- jsonfeed: http://kremalicious.com/feed.json
+ rss: /feed.xml
+ jsonfeed: /feed.json
avatar: ../src/images/avatar.jpg
bitcoin: 171qDmKEXm9YBgBLXyGjjPvopP5o9htQ1V
ether: "0x339dbC44d39bf1961E385ed0Ae88FC6069b87Ea1"
diff --git a/gatsby-config.js b/gatsby-config.js
index 3a67cf71..b4c84f78 100644
--- a/gatsby-config.js
+++ b/gatsby-config.js
@@ -2,14 +2,17 @@ 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
+const { title, tagline, url, author } = meta
// required for gatsby-plugin-meta-redirect
require('regenerator-runtime/runtime')
module.exports = {
siteMetadata: {
- siteUrl: `${url}`
+ title: `${title}`,
+ description: `${tagline}`,
+ siteUrl: `${url}`,
+ author: `${author.name}`
},
plugins: [
{
@@ -116,6 +119,64 @@ module.exports = {
siteUrl: `${url}`
}
},
+ {
+ resolve: 'gatsby-plugin-feed',
+ options: {
+ query: `
+ {
+ site {
+ siteMetadata {
+ title
+ description
+ siteUrl
+ site_url: siteUrl
+ author
+ }
+ }
+ }
+ `,
+ feeds: [
+ {
+ serialize: ({ query: { site, allMarkdownRemark } }) => {
+ return allMarkdownRemark.edges.map(edge => {
+ return Object.assign({}, edge.node.frontmatter, {
+ description: feedContent(edge),
+ url: site.siteMetadata.siteUrl + edge.node.fields.slug,
+ author: site.siteMetadata.author,
+ guid: site.siteMetadata.siteUrl + edge.node.fields.slug
+ })
+ })
+ },
+ query: `
+ {
+ allMarkdownRemark(
+ limit: 20,
+ sort: { order: DESC, fields: [fields___date] }
+ ) {
+ edges {
+ node {
+ html
+ fields { slug, date }
+ frontmatter {
+ title
+ image {
+ childImageSharp {
+ resize(width: 960, quality: 80) {
+ src
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ `,
+ output: '/feed.xml'
+ }
+ ]
+ }
+ },
'gatsby-plugin-react-helmet',
'gatsby-transformer-yaml',
'gatsby-plugin-sharp',
@@ -126,3 +187,11 @@ module.exports = {
'gatsby-plugin-meta-redirect'
]
}
+
+const feedContent = edge => {
+ const { image } = edge.node.frontmatter
+
+ return image
+ ? `
${edge.node.html}`
+ : edge.node.html
+}
diff --git a/package.json b/package.json
index 0878de8c..f690246f 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"gatsby-awesome-pagination": "^0.1.1",
"gatsby-image": "^2.0.0-rc.2",
"gatsby-plugin-catch-links": "^2.0.2-rc.1",
+ "gatsby-plugin-feed": "^1.3.25",
"gatsby-plugin-lunr": "^1.1.0",
"gatsby-plugin-matomo": "^0.5.0",
"gatsby-plugin-meta-redirect": "^1.1.0",