From fb5299b38d88822cf1a8e8d4339813d79ebb5d19 Mon Sep 17 00:00:00 2001 From: Greg Rickaby Date: Mon, 7 Oct 2019 12:56:18 -0500 Subject: [PATCH 1/2] add gatsby-plugin-feed --- package.json | 1 + yarn.lock | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/package.json b/package.json index 7868f2b..94dbd45 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "gatsby": "^2.15.29", "gatsby-image": "^2.2.24", "gatsby-plugin-emotion": "^4.1.9", + "gatsby-plugin-feed": "^2.3.15", "gatsby-plugin-gtag": "^1.0.11", "gatsby-plugin-react-helmet": "^3.1.10", "gatsby-plugin-sharp": "^2.2.28", diff --git a/yarn.lock b/yarn.lock index 2f9f447..ec9b1bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5565,6 +5565,17 @@ gatsby-plugin-emotion@^4.1.9: "@babel/runtime" "^7.6.2" "@emotion/babel-preset-css-prop" "^10.0.17" +gatsby-plugin-feed@^2.3.15: + version "2.3.15" + resolved "https://registry.yarnpkg.com/gatsby-plugin-feed/-/gatsby-plugin-feed-2.3.15.tgz#06c6b0e96176485551ff83abb890184434009c18" + integrity sha512-oe2EFpmHsBTCF2q4nVELnJOjkKCFwakckLdEmSuZaLD5KTuBi19tqysDc3cZgWcFVsrDl78HYkXqelsgYg9YJg== + dependencies: + "@babel/runtime" "^7.6.2" + "@hapi/joi" "^15.1.1" + fs-extra "^8.1.0" + lodash.merge "^4.6.2" + rss "^1.2.2" + gatsby-plugin-gtag@^1.0.11: version "1.0.11" resolved "https://registry.yarnpkg.com/gatsby-plugin-gtag/-/gatsby-plugin-gtag-1.0.11.tgz#1eb9487ce733c4f909703323c1ab7356228c391f" @@ -7748,6 +7759,11 @@ lodash.memoize@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash.throttle@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.throttle/-/lodash.throttle-4.1.1.tgz#c23e91b710242ac70c37f1e1cda9274cc39bf2f4" @@ -8080,6 +8096,18 @@ mime-db@1.40.0, "mime-db@>= 1.40.0 < 2", mime-db@^1.28.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== +mime-db@~1.25.0: + version "1.25.0" + resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.25.0.tgz#c18dbd7c73a5dbf6f44a024dc0d165a1e7b1c392" + integrity sha1-wY29fHOl2/b0SgJNwNFloeexw5I= + +mime-types@2.1.13: + version "2.1.13" + resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.13.tgz#e07aaa9c6c6b9a7ca3012c69003ad25a39e92a88" + integrity sha1-4HqqnGxrmnyjASxpADrSWjnpKog= + dependencies: + mime-db "~1.25.0" + mime-types@^2.1.12, mime-types@~2.1.17, mime-types@~2.1.19, mime-types@~2.1.24: version "2.1.24" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" @@ -10597,6 +10625,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rss@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/rss/-/rss-1.2.2.tgz#50a1698876138133a74f9a05d2bdc8db8d27a921" + integrity sha1-UKFpiHYTgTOnT5oF0r3I240nqSE= + dependencies: + mime-types "2.1.13" + xml "1.0.1" + run-async@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.3.0.tgz#0371ab4ae0bdd720d4166d7dfda64ff7a445a6c0" @@ -12573,6 +12609,11 @@ xml2js@^0.4.5: sax ">=0.6.0" xmlbuilder "~9.0.1" +xml@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5" + integrity sha1-eLpyAgApxbyHuKgaPPzXS0ovweU= + xmlbuilder@~9.0.1: version "9.0.7" resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" From 9dca86964f8ffdd9557b49d81d036312e075bbb1 Mon Sep 17 00:00:00 2001 From: Greg Rickaby Date: Mon, 7 Oct 2019 15:50:37 -0500 Subject: [PATCH 2/2] setup config, but dealing with "reduce" error --- gatsby-config.js | 64 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/gatsby-config.js b/gatsby-config.js index f5c7ea1..8db365e 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,9 +1,9 @@ module.exports = { siteMetadata: { - siteUrl: "https://gatsby.wdslab.com", + siteUrl: "https://gatsby-starter-wordpress-graphql.netlify.com/", organization: { name: "WebDevStudios", - url: "https://gatsby.wdslab.com", + url: "https://webdevstudios.com", logo: "http://gatsby.wdslab.com/wp-content/uploads/2019/08/wds-logo-small.png" }, @@ -38,8 +38,64 @@ module.exports = { // Puts tracking script in the head instead of the body head: false, // enable ip anonymization - anonymize: true, - }, + anonymize: true + } + }, + { + resolve: `gatsby-plugin-feed`, + options: { + query: ` + { + site { + siteMetadata { + site_url: siteUrl + } + } + wordpress { + allSettings { + title: generalSettingsTitle + description: generalSettingsDescription + } + } + } + `, + feeds: [ + { + serialize: ({ query: { site, wordpress } }) => { + wordpress.posts.edges.forEach(edge => { + return { + title: edge.node.title, + description: edge.node.excerpt, + url: site.siteMetadata.site_url + edge.node.slug, + guid: site.siteMetadata.site_url + edge.node.slug + }; + }); + }, + query: ` + { + wordpress { + posts { + edges { + node { + title + excerpt + slug + date + author { + name + } + } + } + } + } + } + `, + output: "/rss.xml", + title: "WebDevStudios RSS", + match: "^/category/blog/" + } + ] + } }, "gatsby-transformer-sharp", "gatsby-plugin-sharp",