diff --git a/.gitignore b/.gitignore index 9e360f6d..2e997703 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ public yarn-debug.log* yarn-error.log yarn-error.log* +.vscode \ No newline at end of file diff --git a/README.md b/README.md index 8658889b..31928926 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ yarn start Visit [`localhost:8000`](http://localhost:8000) to test it. +If you need to query something use ['http://localhost:8000/\_\_\_graphql'](http://localhost:8000/___graphql) + ## Writing a Blog Post - Create a new folder inside the `content/blog/` diff --git a/content/blog/introducing-excalidraw-plus/index.md b/content/blog/introducing-excalidraw-plus/index.md index a100dd07..dac10ed2 100644 --- a/content/blog/introducing-excalidraw-plus/index.md +++ b/content/blog/introducing-excalidraw-plus/index.md @@ -2,7 +2,7 @@ title: Introducing Excalidraw+ date: 2021-05-03 author: Excalidraw Team -link: https://twitter.com/excalidraw +link: https://github.com/orgs/excalidraw/people image: excalidraw-plus.png --- diff --git a/gatsby-config.js b/gatsby-config.js index 2ac23e0e..5bd04dab 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,10 +1,14 @@ +const dayjs = require("dayjs"); + +const siteUrl = process.env.URL || "https://blog.excalidraw.com"; + module.exports = { siteMetadata: { title: "Excalidraw Blog", description: "Get up to speed on the latest news and dive deep into inner workings of Excalidraw", image: "/og-image-3.png", - siteUrl: "https://blog.excalidraw.com", + siteUrl, social: { twitter: "excalidraw", github: "excalidraw", @@ -73,7 +77,60 @@ module.exports = { }, "gatsby-plugin-dark-mode", "gatsby-transformer-sharp", - "gatsby-plugin-sitemap", + { + resolve: "gatsby-plugin-sitemap", + options: { + query: ` + { + site { + siteMetadata { + siteUrl + } + } + allSitePage { + nodes { + path + } + } + allMarkdownRemark { + nodes { + fields { + slug + } + frontmatter { + date(formatString: "YYYY-MM-DD") + } + } + } + } + `, + resolveSiteUrl: () => siteUrl, + serialize: ({ site, allMarkdownRemark }) => { + // nodes looks like array but its acutally an object + const pages = allMarkdownRemark.nodes.reduce((acc, node) => { + acc.push({ + url: `${site.siteMetadata.siteUrl}${node.fields.slug}`, + changefreq: `yearly`, + priority: 0.4, + lastmod: node.frontmatter.date, + }); + + return acc; + }, []); + + return [ + ...pages, + // manually add root + { + url: `${site.siteMetadata.siteUrl}`, + changefreq: `weekly`, + priority: 1, + lastmod: dayjs(new Date()).format("YYYY-MM-DD"), + }, + ]; + }, + }, + }, "gatsby-plugin-sharp", { resolve: "gatsby-plugin-google-analytics", diff --git a/package.json b/package.json index 79778a98..d429eefd 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "author": "Christopher Chedeau ", "dependencies": { "@weknow/gatsby-remark-twitter": "0.2.3", + "dayjs": "1.11.7", "gatsby": "2.32.12", "gatsby-embedder-excalidraw": "1.1.4", "gatsby-image": "3.11.0", diff --git a/static/robots.txt b/static/robots.txt index eb053628..a1e7cfbc 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,2 +1,3 @@ User-agent: * Disallow: +Sitemap: https://blog.excalidraw.com/sitemap.xml diff --git a/yarn.lock b/yarn.lock index 407f9c5e..8c790508 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3433,20 +3433,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0: - version "1.0.30000987" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000987.tgz#bc6b47217afd8226a2b1964635c6bff62cdf5738" - integrity sha512-O3VrjtRMTxoU5Cn5/QSmXeIR1gkVps4j9jqfIm4FLaQ5JzqBlVjMUG1xWnoYFv8N+H3Lp++aa05TekyIbjHL7g== - -caniuse-lite@^1.0.30001109: - version "1.0.30001151" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001151.tgz#1ddfde5e6fff02aad7940b4edb7d3ac76b0cb00b" - integrity sha512-Zh3sHqskX6mHNrqUerh+fkf0N72cMxrmflzje/JyVImfpknscMnkeJrlFGJcqTmaa0iszdYptGpWMJCRQDkBVw== - -caniuse-lite@^1.0.30001157: - version "1.0.30001161" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001161.tgz#64f7ffe79ee780b8c92843ff34feb36cea4651e0" - integrity sha512-JharrCDxOqPLBULF9/SPa6yMcBRTjZARJ6sc3cuKrPfyIk64JN6kuMINWqA99Xc8uElMFcROliwtz0n9pYej+g== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001157: + version "1.0.30001482" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001482.tgz" + integrity sha512-F1ZInsg53cegyjroxLNW9DmrEQ1SuGRTO1QlpA0o2/6OpQ0gFeDRoq1yFmnr8Sakn9qwwt9DmbxHB6w167OSuQ== caw@^2.0.0, caw@^2.0.1: version "2.0.1" @@ -4416,6 +4406,11 @@ date-now@^0.1.4: resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" integrity sha1-6vQ5/U1ISK105cx9vvIAZyueNFs= +dayjs@1.11.7: + version "1.11.7" + resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" + integrity sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ== + debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.6, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"