Skip to content

Commit

Permalink
Feat: Add RSS
Browse files Browse the repository at this point in the history
Feat: Add sitemap
  • Loading branch information
portableant committed Dec 30, 2022
1 parent 7981c76 commit e8036f3
Show file tree
Hide file tree
Showing 5 changed files with 359 additions and 4 deletions.
81 changes: 81 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*
* See: https://www.gatsbyjs.com/docs/reference/config-files/gatsby-config/
*/
const siteUrl = `https://blog.micropasts.org`

/**
* @type {import('gatsby').GatsbyConfig}
Expand Down Expand Up @@ -137,6 +138,35 @@ module.exports = {
}
}
},
{
resolve: "gatsby-plugin-sitemap",
options: {
query: `
{
allSitePage {
nodes {
path
}
}
}
`,
resolveSiteUrl: () => siteUrl,
resolvePages: ({
allSitePage: { nodes: allPages }
}) => {

return allPages.map(page => {
return { ...page };
});
},
serialize: ({ path }) => {
return {
url: path
};
}
}
},
{
resolve: `gatsby-plugin-google-gtag`,
options: {
Expand All @@ -148,6 +178,57 @@ module.exports = {
},
},
},
{
resolve: `gatsby-plugin-feed`,
options: {
query: `
{
site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}
}
`,
feeds: [
{
serialize: ({ query: { site, allMarkdownRemark } }) => {
return allMarkdownRemark.nodes.map(node => {
return Object.assign({}, node.frontmatter, {
description: node.excerpt,
date: node.frontmatter.date,
url: site.siteMetadata.siteUrl + node.frontmatter.permalink,
guid: site.siteMetadata.siteUrl + node.frontmatter.permalink,
custom_elements: [{ "content:encoded": node.html }],
})
})
},
query: `
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___date] },
) {
nodes {
excerpt
html
frontmatter {
title
date
permalink
}
}
}
}
`,
output: "/rss.xml",
title: "MicroPasts Blog RSS Feed"
},
],
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
Expand Down
Loading

0 comments on commit e8036f3

Please sign in to comment.