Created
July 14, 2020 11:21
-
-
Save erluxman/5001139e8108f8c4157095824e70cd40 to your computer and use it in GitHub Desktop.
GatsbyConfigfile for stackoverflow question
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
siteMetadata: { | |
title: 'erluxman', | |
author: 'Laxman Bhattarai', | |
description: 'My Journey with Code', | |
siteUrl: 'https://erluxman.com', | |
social: { | |
twitter: '@erluxman', | |
}, | |
}, | |
pathPrefix: '/', | |
plugins: [ | |
{ | |
resolve: `gatsby-source-filesystem`, | |
options: { | |
path: `${__dirname}/src/pages`, | |
name: 'pages', | |
}, | |
}, | |
{ | |
resolve: `gatsby-transformer-remark`, | |
options: { | |
plugins: [ | |
{ | |
resolve: `gatsby-remark-images`, | |
options: { | |
maxWidth: 590, | |
}, | |
}, | |
{ | |
resolve: `gatsby-remark-responsive-iframe`, | |
options: { | |
wrapperStyle: `margin-bottom: 1.0725rem`, | |
}, | |
}, | |
'gatsby-remark-autolink-headers', | |
{ | |
resolve: 'gatsby-remark-prismjs', | |
options: { | |
inlineCodeMarker: '÷', | |
}, | |
}, | |
'gatsby-remark-copy-linked-files', | |
'gatsby-remark-smartypants', | |
{ | |
resolve: 'gatsby-remark-external-links', | |
options: { | |
target: '_blank', | |
}, | |
}, | |
], | |
}, | |
}, | |
`gatsby-transformer-sharp`, | |
`gatsby-plugin-sharp`, | |
{ | |
resolve: `gatsby-plugin-google-analytics`, | |
options: { | |
trackingId: `UA-130227707-1`, | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-feed`, | |
options: { | |
query: ` | |
{ | |
site { | |
siteMetadata { | |
title | |
description | |
siteUrl | |
site_url: siteUrl | |
} | |
} | |
} | |
`, | |
feeds: [ | |
{ | |
serialize: ({ query: { site, allMarkdownRemark } }) => { | |
return allMarkdownRemark.edges.map(edge => { | |
const siteUrl = site.siteMetadata.siteUrl; | |
const postText = ` | |
<div style="margin-top=55px; font-style: italic;">(This is an article posted to my blog at erluxman.com. You can read it online by <a href="${siteUrl + | |
edge.node.fields.slug}">clicking here</a>.)</div> | |
`; | |
let html = edge.node.html; | |
html = html | |
.replace(/href="\//g, `href="${siteUrl}/`) | |
.replace(/src="\//g, `src="${siteUrl}/`) | |
.replace(/"\/static\//g, `"${siteUrl}/static/`) | |
.replace(/,\s*\/static\//g, `,${siteUrl}/static/`); | |
return Object.assign({}, edge.node.frontmatter, { | |
description: edge.node.frontmatter.spoiler, | |
date: edge.node.frontmatter.date, | |
url: site.siteMetadata.siteUrl + edge.node.fields.slug, | |
guid: site.siteMetadata.siteUrl + edge.node.fields.slug, | |
custom_elements: [{ 'content:encoded': html + postText }], | |
}); | |
}); | |
}, | |
query: ` | |
{ | |
allMarkdownRemark( | |
limit: 1000, | |
sort: { order: DESC, fields: [frontmatter___date] } | |
filter: {fields: { langKey: {eq: "en"}}} | |
) { | |
edges { | |
node { | |
excerpt(pruneLength: 250) | |
html | |
fields { | |
slug | |
} | |
frontmatter { | |
title | |
date | |
spoiler | |
} | |
} | |
} | |
} | |
} | |
`, | |
output: '/rss.xml', | |
title: "erluxman's personal blog RSS Feed", | |
}, | |
], | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-ebook`, | |
options: { | |
filename: 'erluxman-ebook.epub', | |
query: ` | |
{ | |
site { | |
siteMetadata { | |
title | |
author | |
} | |
} | |
allMarkdownRemark( | |
sort: { fields: frontmatter___date, order: ASC }, | |
filter: { fields: { langKey: { eq: "en" } } } | |
) { | |
edges { | |
node { | |
id | |
fileAbsolutePath | |
rawMarkdownBody | |
frontmatter { | |
title | |
date | |
} | |
} | |
} | |
} | |
}`, | |
}, | |
}, | |
{ | |
resolve: `gatsby-plugin-manifest`, | |
options: { | |
name: `Erluxman`, | |
short_name: `Erluxman`, | |
start_url: `/`, | |
background_color: `#ffffff`, | |
theme_color: `#ffa7c4`, | |
display: `minimal-ui`, | |
icon: `src/assets/icon.png`, | |
theme_color_in_head: false, | |
}, | |
}, | |
`gatsby-plugin-react-helmet`, | |
{ | |
resolve: 'gatsby-plugin-typography', | |
options: { | |
pathToConfigModule: 'src/utils/typography', | |
}, | |
}, | |
{ | |
resolve: 'gatsby-plugin-i18n', | |
options: { | |
langKeyDefault: 'en', | |
useLangKeyLayout: false, | |
}, | |
}, | |
`gatsby-plugin-catch-links`, | |
], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment