├── .eslintrc ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs └── logo.svg ├── examples └── starter-blog │ ├── .all-contributorsrc │ ├── .gitignore │ ├── .prettierrc │ ├── LICENSE │ ├── README.md │ ├── content │ └── blog │ │ ├── hello-world │ │ ├── index.md │ │ └── salty_egg.jpg │ │ ├── hi-folks │ │ └── index.md │ │ └── my-second-post │ │ └── index.md │ ├── gatsby-config.js │ ├── gatsby-node.js │ ├── package.json │ ├── src │ ├── assets │ │ ├── images │ │ │ └── gatsby-icon.png │ │ └── stylesheets │ │ │ └── style.scss │ ├── components │ │ ├── Footer.js │ │ ├── PostsList.js │ │ ├── PostsListCard.js │ │ ├── layout.js │ │ └── seo.js │ ├── pages │ │ ├── 404.js │ │ └── index.js │ └── templates │ │ ├── blog-post.js │ │ ├── category.js │ │ └── tag.js │ ├── static │ ├── favicon.ico │ └── robots.txt │ └── yarn.lock ├── lerna.json ├── package.json ├── packages ├── gatsby-plugin-categories │ ├── .babelrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── src │ │ ├── __tests__ │ │ └── internals.js │ │ ├── defaults.js │ │ ├── gatsby-node.js │ │ └── internals.js ├── gatsby-plugin-tags │ ├── .babelrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── src │ │ ├── __tests__ │ │ └── internals.js │ │ ├── defaults.js │ │ ├── gatsby-node.js │ │ └── internals.js └── gatsby-source-all-contributors │ ├── .babelrc │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── package.json │ └── src │ ├── .gitkeep │ └── gatsby-node.js ├── plop-templates └── plugin │ ├── .babelrc.hbs │ ├── .gitignore.hbs │ ├── LICENSE.hbs │ ├── README.md.hbs │ ├── index.js.hbs │ ├── package.json.hbs │ └── src │ └── .gitkeep ├── plopfile.js └── yarn.lock /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "extends": [ 4 | "airbnb-base", 5 | "plugin:prettier/recommended" 6 | ], 7 | "env": { 8 | "browser": true, 9 | "es6": true, 10 | "node": true, 11 | "jest": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages/*/package-lock.json 2 | packages/*/yarn.lock 3 | node_modules 4 | lerna-debug.log 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [2.3.7](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.6...v2.3.7) (2019-10-20) 7 | 8 | **Note:** Version bump only for package gatsby-pantry 9 | 10 | 11 | 12 | 13 | 14 | ## [2.3.6](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.5...v2.3.6) (2019-08-28) 15 | 16 | **Note:** Version bump only for package gatsby-pantry 17 | 18 | 19 | 20 | 21 | 22 | ## [2.3.5](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.4...v2.3.5) (2019-07-25) 23 | 24 | **Note:** Version bump only for package gatsby-pantry 25 | 26 | 27 | 28 | 29 | 30 | ## [2.3.4](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.3...v2.3.4) (2019-07-24) 31 | 32 | **Note:** Version bump only for package gatsby-pantry 33 | 34 | 35 | 36 | 37 | 38 | ## [2.3.3](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.2...v2.3.3) (2019-07-15) 39 | 40 | **Note:** Version bump only for package gatsby-pantry 41 | 42 | 43 | 44 | 45 | 46 | ## [2.3.2](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.1...v2.3.2) (2019-06-10) 47 | 48 | **Note:** Version bump only for package gatsby-pantry 49 | 50 | 51 | 52 | 53 | 54 | ## [2.3.1](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.3.0...v2.3.1) (2019-05-28) 55 | 56 | **Note:** Version bump only for package gatsby-pantry 57 | 58 | 59 | 60 | 61 | 62 | # [2.3.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.2.0...v2.3.0) (2019-04-04) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * building tags should work again... oops ([6e6c97e](https://github.com/rmcfadzean/gatsby-pantry/commit/6e6c97e)) 68 | * **examples:** content insecure warnings ([cdf845b](https://github.com/rmcfadzean/gatsby-pantry/commit/cdf845b)) 69 | 70 | 71 | 72 | 73 | 74 | # [2.2.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.1.0...v2.2.0) (2019-03-18) 75 | 76 | 77 | ### Bug Fixes 78 | 79 | * don't try make categories if there aren't any ([70763b8](https://github.com/rmcfadzean/gatsby-pantry/commit/70763b8)) 80 | * removed githead ([9dde763](https://github.com/rmcfadzean/gatsby-pantry/commit/9dde763)) 81 | * tidying up ([48a3195](https://github.com/rmcfadzean/gatsby-pantry/commit/48a3195)) 82 | 83 | 84 | 85 | 86 | 87 | # [2.1.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v2.0.0...v2.1.0) (2019-02-07) 88 | 89 | 90 | ### Bug Fixes 91 | 92 | * Don't crash when some .md files dont have tags either. ([070e03d](https://github.com/rmcfadzean/gatsby-pantry/commit/070e03d)) 93 | * removed an accidentally commited directory ([6ec69ca](https://github.com/rmcfadzean/gatsby-pantry/commit/6ec69ca)) 94 | * Update createPages to work when some .md files don't have category set. ([#8](https://github.com/rmcfadzean/gatsby-pantry/issues/8)) ([52724ac](https://github.com/rmcfadzean/gatsby-pantry/commit/52724ac)) 95 | 96 | 97 | 98 | 99 | 100 | # [2.0.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.2.0...v2.0.0) (2019-01-19) 101 | 102 | 103 | ### Features 104 | 105 | * more robust slugging and using fields instead of frontmatter ([3468aae](https://github.com/rmcfadzean/gatsby-pantry/commit/3468aae)) 106 | 107 | 108 | 109 | 110 | 111 | # [1.2.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.1.2...v1.2.0) (2018-10-31) 112 | 113 | **Note:** Version bump only for package gatsby-pantry 114 | 115 | 116 | 117 | 118 | 119 | 120 | ## [1.1.2](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.1.1...v1.1.2) (2018-09-27) 121 | 122 | 123 | ### Bug Fixes 124 | 125 | * escape author values, remove extra comma ([a9a577a](https://github.com/rmcfadzean/gatsby-pantry/commit/a9a577a)) 126 | * **gatsby-plugin-categories:** removed pointless set to array conversion ([71d2c9b](https://github.com/rmcfadzean/gatsby-pantry/commit/71d2c9b)) 127 | * **gatsby-plugin-tags:** no longer missing tags ([8fb9af7](https://github.com/rmcfadzean/gatsby-pantry/commit/8fb9af7)) 128 | 129 | 130 | 131 | 132 | 133 | 134 | ## [1.1.1](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.1.0...v1.1.1) (2018-08-18) 135 | 136 | 137 | ### Bug Fixes 138 | 139 | * changed the lerna publish style ([5ffda3b](https://github.com/rmcfadzean/gatsby-pantry/commit/5ffda3b)) 140 | * kebabCased tags & categories ([1ca7478](https://github.com/rmcfadzean/gatsby-pantry/commit/1ca7478)) 141 | 142 | 143 | 144 | 145 | 146 | 147 | # [1.1.0](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.0.4...v1.1.0) (2018-08-18) 148 | 149 | 150 | ### Bug Fixes 151 | 152 | * bump categories -> 1.0.4 ([262b4a1](https://github.com/rmcfadzean/gatsby-pantry/commit/262b4a1)) 153 | * fixed version ([d1f7d2a](https://github.com/rmcfadzean/gatsby-pantry/commit/d1f7d2a)) 154 | 155 | 156 | ### Features 157 | 158 | * added gatsby-plugin-categories ([acfce6f](https://github.com/rmcfadzean/gatsby-pantry/commit/acfce6f)) 159 | 160 | 161 | 162 | 163 | 164 | 165 | ## [1.0.4](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.0.3...v1.0.4) (2018-08-18) 166 | 167 | **Note:** Version bump only for package gatsby-pantry 168 | 169 | 170 | 171 | 172 | 173 | 174 | ## [1.0.3](https://github.com/rmcfadzean/gatsby-pantry/compare/v1.0.2...v1.0.3) (2018-08-18) 175 | 176 | 177 | ### Bug Fixes 178 | 179 | * added metadata to package.json ([389e8be](https://github.com/rmcfadzean/gatsby-pantry/commit/389e8be)) 180 | * removed bad link in readme ([b7593cd](https://github.com/rmcfadzean/gatsby-pantry/commit/b7593cd)) 181 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Rob McFadzean 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gatsby Pantry 2 | 3 |
4 | 5 |
6 | 7 |
8 | 9 | Released under the MIT license. 13 | 14 | Awesome? Almost! 18 |
19 | 20 | ## What is this? 21 | 22 | * [gatsby-plugin-tags](/packages/gatsby-plugin-tags/) 23 | * [gatsby-plugin-categories](/packages/gatsby-plugin-categories/) 24 | * [an example blog using the above plugins](/examples/starter-blog/) 25 | 26 | ## Demo 27 | 28 | You can find a demo [here](https://gatsby-pantry-starter-demo.netlify.com/) 29 | 30 | ## Contributing 31 | 32 | *TODO* 33 | 34 | ### Notes 35 | 36 | This repository is a monorepo managed using [Lerna](https://github.com/lerna/lerna). 37 | 38 | ## Credits 39 | 40 | * :heart: [Gatsby](https://github.com/gatsbyjs/gatsby/) 41 | 42 | Made with :fireworks: in Chicago by [North x South](https://www.northxsouth.co) -------------------------------------------------------------------------------- /docs/logo.svg: -------------------------------------------------------------------------------- 1 | gatsby-kitchen-logo -------------------------------------------------------------------------------- /examples/starter-blog/.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "gatsby-starter-blog", 3 | "projectOwner": "rmcfadzean", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": ["README.md"], 7 | "imageSize": 100, 8 | "commit": true, 9 | "contributors": [ 10 | { 11 | "login": "blindingstars", 12 | "name": "Stephy", 13 | "avatar_url": "https://avatars3.githubusercontent.com/u/6765732?s=460&v=4", 14 | "profile": "https://github.com/blindingstars", 15 | "contributions": ["code", "design", "ideas", "bug"] 16 | }, 17 | { 18 | "login": "rmcfadzean", 19 | "name": "Rob McFadzean", 20 | "avatar_url": "https://avatars3.githubusercontent.com/u/222057?s=460&v=4", 21 | "profile": "https://github.com/blindingstars", 22 | "contributions": ["code", "ideas", "bug"] 23 | } 24 | ], 25 | "contributorsPerLine": 7 26 | } 27 | -------------------------------------------------------------------------------- /examples/starter-blog/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (http://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # Typescript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # dotenv environment variables file 55 | .env 56 | 57 | # gatsby files 58 | .cache/ 59 | public 60 | 61 | # Mac files 62 | .DS_Store 63 | 64 | # Yarn 65 | yarn-error.log 66 | .pnp/ 67 | .pnp.js 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | -------------------------------------------------------------------------------- /examples/starter-blog/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "endOfLine": "lf", 3 | "semi": false, 4 | "singleQuote": false, 5 | "tabWidth": 2, 6 | "trailingComma": "es5" 7 | } 8 | -------------------------------------------------------------------------------- /examples/starter-blog/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019 Rob McFadzean 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /examples/starter-blog/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-starter-blog 2 | 3 |
4 | 5 |
6 | 7 |
8 | 9 | Released under the MIT license. 13 | 14 |
15 | 16 | ## What is this? 17 | 18 | This is a very stripped down version of [Gatsby Starter Blog](https://github.com/gatsbyjs/gatsby-starter-blog) created to demonstrate the following plugins: 19 | 20 | * [gatsby-plugin-tags](../../packages/gatsby-plugin-tags/) 21 | * [gatsby-plugin-categories](../../packages/gatsby-plugin-categories/) 22 | 23 | 24 | ## Credits 25 | 26 | * :heart: [Gatsby](https://github.com/gatsbyjs/gatsby/) 27 | -------------------------------------------------------------------------------- /examples/starter-blog/content/blog/hello-world/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Hello World 3 | date: "2015-05-01T22:12:03.284Z" 4 | category: Example Category 5 | tags: 6 | - example 7 | - post 8 | --- 9 | 10 | This is my first post on my new fake blog! How exciting! 11 | 12 | I'm sure I'll write a lot more interesting things in the future. 13 | 14 | Oh, and here's a great quote from this Wikipedia on 15 | [salted duck eggs](http://en.wikipedia.org/wiki/Salted_duck_egg). 16 | 17 | > A salted duck egg is a Chinese preserved food product made by soaking duck 18 | > eggs in brine, or packing each egg in damp, salted charcoal. In Asian 19 | > supermarkets, these eggs are sometimes sold covered in a thick layer of salted 20 | > charcoal paste. The eggs may also be sold with the salted paste removed, 21 | > wrapped in plastic, and vacuum packed. From the salt curing process, the 22 | > salted duck eggs have a briny aroma, a gelatin-like egg white and a 23 | > firm-textured, round yolk that is bright orange-red in color. 24 | 25 | ![Chinese Salty Egg](./salty_egg.jpg) 26 | -------------------------------------------------------------------------------- /examples/starter-blog/content/blog/hello-world/salty_egg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmcfadzean/gatsby-pantry/0eaf71c5f8b73477fae786320c90955b70626366/examples/starter-blog/content/blog/hello-world/salty_egg.jpg -------------------------------------------------------------------------------- /examples/starter-blog/content/blog/hi-folks/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: New Beginnings 3 | date: "2015-05-28T22:40:32.169Z" 4 | description: This is a custom description for SEO and Open Graph purposes, rather than the default generated excerpt. Simply add a description field to the frontmatter. 5 | category: Demo Category 6 | --- 7 | 8 | Far far away, behind the word mountains, far from the countries Vokalia and 9 | Consonantia, there live the blind texts. Separated they live in Bookmarksgrove 10 | right at the coast of the Semantics, a large language ocean. A small river named 11 | Duden flows by their place and supplies it with the necessary regelialia. 12 | 13 | ## On deer horse aboard tritely yikes and much 14 | 15 | The Big Oxmox advised her not to do so, because there were thousands of bad 16 | Commas, wild Question Marks and devious Semikoli, but the Little Blind Text 17 | didn’t listen. She packed her seven versalia, put her initial into the belt and 18 | made herself on the way. 19 | 20 | - This however showed weasel 21 | - Well uncritical so misled 22 | - this is very interesting 23 | - Goodness much until that fluid owl 24 | 25 | When she reached the first hills of the **Italic Mountains**, she had a last 26 | view back on the skyline of her hometown _Bookmarksgrove_, the headline of 27 | [Alphabet Village](http://google.com) and the subline of her own road, the Line 28 | Lane. Pityful a rethoric question ran over her cheek, then she continued her 29 | way. On her way she met a copy. 30 | 31 | ### Overlaid the jeepers uselessly much excluding 32 | 33 | But nothing the copy said could convince her and so it didn’t take long until a 34 | few insidious Copy Writers ambushed her, made her drunk with 35 | [Longe and Parole](http://google.com) and dragged her into their agency, where 36 | they abused her for their projects again and again. And if she hasn’t been 37 | rewritten, then they are still using her. 38 | 39 | > Far far away, behind the word mountains, far from the countries Vokalia and 40 | > Consonantia, there live the blind texts. Separated they live in Bookmarksgrove 41 | > right at the coast of the Semantics, a large language ocean. 42 | 43 | It is a paradisematic country, in which roasted parts of sentences fly into your 44 | mouth. Even the all-powerful Pointing has no control about the blind texts it is 45 | an almost unorthographic life One day however a small line of blind text by the 46 | name of Lorem Ipsum decided to leave for the far World of Grammar. 47 | 48 | ### According a funnily until pre-set or arrogant well cheerful 49 | 50 | The Big Oxmox advised her not to do so, because there were thousands of bad 51 | Commas, wild Question Marks and devious Semikoli, but the Little Blind Text 52 | didn’t listen. She packed her seven versalia, put her initial into the belt and 53 | made herself on the way. 54 | 55 | 1. So baboon this 56 | 2. Mounted militant weasel gregariously admonishingly straightly hey 57 | 3. Dear foresaw hungry and much some overhung 58 | 4. Rash opossum less because less some amid besides yikes jeepers frenetic 59 | impassive fruitlessly shut 60 | 61 | When she reached the first hills of the Italic Mountains, she had a last view 62 | back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet 63 | Village and the subline of her own road, the Line Lane. Pityful a rethoric 64 | question ran over her cheek, then she continued her way. On her way she met a 65 | copy. 66 | 67 | > The copy warned the Little Blind Text, that where it came from it would have 68 | > been rewritten a thousand times and everything that was left from its origin 69 | > would be the word "and" and the Little Blind Text should turn around and 70 | > return to its own, safe country. 71 | 72 | But nothing the copy said could convince her and so it didn’t take long until a 73 | few insidious Copy Writers ambushed her, made her drunk with Longe and Parole 74 | and dragged her into their agency, where they abused her for their projects 75 | again and again. And if she hasn’t been rewritten, then they are still using 76 | her. Far far away, behind the word mountains, far from the countries Vokalia and 77 | Consonantia, there live the blind texts. 78 | 79 | #### Silent delightfully including because before one up barring chameleon 80 | 81 | Separated they live in Bookmarksgrove right at the coast of the Semantics, a 82 | large language ocean. A small river named Duden flows by their place and 83 | supplies it with the necessary regelialia. It is a paradisematic country, in 84 | which roasted parts of sentences fly into your mouth. 85 | 86 | Even the all-powerful Pointing has no control about the blind texts it is an 87 | almost unorthographic life One day however a small line of blind text by the 88 | name of Lorem Ipsum decided to leave for the far World of Grammar. The Big Oxmox 89 | advised her not to do so, because there were thousands of bad Commas, wild 90 | Question Marks and devious Semikoli, but the Little Blind Text didn’t listen. 91 | 92 | ##### Wherever far wow thus a squirrel raccoon jeez jaguar this from along 93 | 94 | She packed her seven versalia, put her initial into the belt and made herself on 95 | the way. When she reached the first hills of the Italic Mountains, she had a 96 | last view back on the skyline of her hometown Bookmarksgrove, the headline of 97 | Alphabet Village and the subline of her own road, the Line Lane. Pityful a 98 | rethoric question ran over her cheek, then she continued her way. On her way she 99 | met a copy. 100 | 101 | ###### Slapped cozy a that lightheartedly and far 102 | 103 | The copy warned the Little Blind Text, that where it came from it would have 104 | been rewritten a thousand times and everything that was left from its origin 105 | would be the word "and" and the Little Blind Text should turn around and return 106 | to its own, safe country. But nothing the copy said could convince her and so it 107 | didn’t take long until a few insidious Copy Writers ambushed her, made her drunk 108 | with Longe and Parole and dragged her into their agency, where they abused her 109 | for their projects again and again. 110 | -------------------------------------------------------------------------------- /examples/starter-blog/content/blog/my-second-post/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: My Second Post! 3 | date: "2015-05-06T23:46:37.121Z" 4 | tags: 5 | - cats 6 | - dogs 7 | --- 8 | 9 | Wow! I love blogging so much already. 10 | 11 | Did you know that "despite its name, salted duck eggs can also be made from 12 | chicken eggs, though the taste and texture will be somewhat different, and the 13 | egg yolk will be less rich."? 14 | ([Wikipedia Link](http://en.wikipedia.org/wiki/Salted_duck_egg)) 15 | 16 | Yeah, I didn't either. 17 | -------------------------------------------------------------------------------- /examples/starter-blog/gatsby-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | siteMetadata: { 3 | title: `Gatsby Pantry Starter`, 4 | author: `Rob McFadzean`, 5 | description: `A starter blog demonstrating https://github.com/rmcfadzean/gatsby-pantry`, 6 | siteUrl: `https://gatsby-pantry-starter-demo.netlify.com/`, 7 | social: { 8 | twitter: `rmcfadzean`, 9 | }, 10 | }, 11 | plugins: [ 12 | { 13 | resolve: `gatsby-source-all-contributors`, 14 | }, 15 | { 16 | resolve: `gatsby-source-filesystem`, 17 | options: { 18 | path: `${__dirname}/content/blog`, 19 | name: `blog`, 20 | }, 21 | }, 22 | { 23 | resolve: `gatsby-source-filesystem`, 24 | options: { 25 | path: `${__dirname}/src/assets`, 26 | name: `assets`, 27 | }, 28 | }, 29 | { 30 | resolve: `gatsby-transformer-remark`, 31 | options: { 32 | plugins: [ 33 | { 34 | resolve: `gatsby-remark-images`, 35 | options: { 36 | maxWidth: 590, 37 | }, 38 | }, 39 | `gatsby-remark-prismjs`, 40 | `gatsby-remark-copy-linked-files`, 41 | ], 42 | }, 43 | }, 44 | `gatsby-transformer-sharp`, 45 | `gatsby-plugin-sharp`, 46 | `gatsby-plugin-feed`, 47 | `gatsby-plugin-react-helmet`, 48 | { 49 | resolve: `gatsby-plugin-sass`, 50 | options: { 51 | precision: 8, 52 | }, 53 | }, 54 | // { 55 | // resolve: "gatsby-plugin-tags", 56 | // options: { 57 | // templatePath: path.join(__dirname, "/src/templates/tag.js"), 58 | // }, 59 | // }, 60 | { 61 | resolve: "gatsby-plugin-categories", 62 | options: { 63 | templatePath: `${__dirname}/src/templates/category.js`, 64 | }, 65 | }, 66 | { 67 | resolve: "gatsby-plugin-tags", 68 | options: { 69 | templatePath: `${__dirname}/src/templates/tag.js`, 70 | }, 71 | }, 72 | ], 73 | } 74 | -------------------------------------------------------------------------------- /examples/starter-blog/gatsby-node.js: -------------------------------------------------------------------------------- 1 | const path = require(`path`) 2 | const { createFilePath } = require(`gatsby-source-filesystem`) 3 | 4 | exports.createPages = ({ graphql, actions }) => { 5 | const { createPage } = actions 6 | 7 | const blogPost = path.resolve(`./src/templates/blog-post.js`) 8 | return graphql( 9 | ` 10 | { 11 | allMarkdownRemark( 12 | sort: { fields: [frontmatter___date], order: DESC } 13 | limit: 1000 14 | ) { 15 | edges { 16 | node { 17 | fields { 18 | slug 19 | } 20 | frontmatter { 21 | title 22 | } 23 | } 24 | } 25 | } 26 | } 27 | ` 28 | ).then(result => { 29 | if (result.errors) { 30 | throw result.errors 31 | } 32 | 33 | // Create blog posts pages. 34 | const posts = result.data.allMarkdownRemark.edges 35 | 36 | posts.forEach((post, index) => { 37 | const previous = index === posts.length - 1 ? null : posts[index + 1].node 38 | const next = index === 0 ? null : posts[index - 1].node 39 | 40 | createPage({ 41 | path: post.node.fields.slug, 42 | component: blogPost, 43 | context: { 44 | slug: post.node.fields.slug, 45 | previous, 46 | next, 47 | }, 48 | }) 49 | }) 50 | 51 | return null 52 | }) 53 | } 54 | 55 | exports.onCreateNode = ({ node, actions, getNode }) => { 56 | const { createNodeField } = actions 57 | 58 | if (node.internal.type === `MarkdownRemark`) { 59 | const value = createFilePath({ node, getNode }) 60 | createNodeField({ 61 | name: `slug`, 62 | node, 63 | value, 64 | }) 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /examples/starter-blog/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-starter-blog", 3 | "private": true, 4 | "description": "A starter blog demonstrating https://github.com/rmcfadzean/gatsby-pantry", 5 | "version": "0.1.0", 6 | "author": "Rob McFadzean ", 7 | "bugs": { 8 | "url": "https://github.com/gatsbyjs/gatsby/issues" 9 | }, 10 | "dependencies": { 11 | "bootstrap": "^4.3.1", 12 | "gatsby": "^2.14.1", 13 | "gatsby-image": "^2.2.14", 14 | "gatsby-plugin-categories": "^2.3.5", 15 | "gatsby-plugin-feed": "^2.3.9", 16 | "gatsby-plugin-react-helmet": "^3.1.5", 17 | "gatsby-plugin-sass": "^2.1.12", 18 | "gatsby-plugin-sharp": "^2.2.18", 19 | "gatsby-plugin-tags": "^2.3.5", 20 | "gatsby-remark-copy-linked-files": "^2.1.13", 21 | "gatsby-remark-images": "^3.1.19", 22 | "gatsby-remark-prismjs": "^3.3.9", 23 | "gatsby-source-filesystem": "^2.1.18", 24 | "gatsby-transformer-remark": "^2.6.19", 25 | "gatsby-transformer-sharp": "^2.2.12", 26 | "node-sass": "^4.12.0", 27 | "prismjs": "^1.17.1", 28 | "react": "^16.9.0", 29 | "react-bootstrap": "^1.0.0-beta.12", 30 | "react-dom": "^16.9.0", 31 | "react-helmet": "^5.2.1", 32 | "referrer-policy": "^1.2.0" 33 | }, 34 | "devDependencies": { 35 | "prettier": "^1.18.2" 36 | }, 37 | "homepage": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/examples/starter-blog#readme", 38 | "keywords": [ 39 | "gatsby" 40 | ], 41 | "license": "MIT", 42 | "main": "n/a", 43 | "scripts": { 44 | "build": "gatsby build", 45 | "develop": "gatsby develop", 46 | "format": "prettier --write src/**/*.{js,jsx}", 47 | "start": "yarn develop", 48 | "serve": "gatsby serve", 49 | "test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\"" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /examples/starter-blog/src/assets/images/gatsby-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmcfadzean/gatsby-pantry/0eaf71c5f8b73477fae786320c90955b70626366/examples/starter-blog/src/assets/images/gatsby-icon.png -------------------------------------------------------------------------------- /examples/starter-blog/src/assets/stylesheets/style.scss: -------------------------------------------------------------------------------- 1 | @import "~bootstrap/scss/bootstrap"; 2 | -------------------------------------------------------------------------------- /examples/starter-blog/src/components/Footer.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Container } from "react-bootstrap" 3 | 4 | const Footer = () => { 5 | return ( 6 | 15 | ) 16 | } 17 | 18 | export default Footer 19 | -------------------------------------------------------------------------------- /examples/starter-blog/src/components/PostsList.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import PostsListCard from "./PostsListCard" 3 | 4 | const PostsList = ({ postEdges }) => { 5 | return postEdges.map(({ node }) => { 6 | return 7 | }) 8 | } 9 | 10 | export default PostsList 11 | -------------------------------------------------------------------------------- /examples/starter-blog/src/components/PostsListCard.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Link } from "gatsby" 3 | import { Card } from "react-bootstrap" 4 | 5 | const PostsListCard = ({ frontmatter, fields, excerpt }) => { 6 | const title = frontmatter.title || fields.slug 7 | 8 | return ( 9 | 10 | 11 |

{title}

12 |
17 | 18 | Read More → 19 | 20 | 21 | 22 | Posted on {frontmatter.date} 23 | 24 | 25 | ) 26 | } 27 | 28 | export default PostsListCard 29 | -------------------------------------------------------------------------------- /examples/starter-blog/src/components/layout.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Nav, Container } from "react-bootstrap" 3 | import { Link } from "gatsby" 4 | import Footer from "./Footer" 5 | import "../assets/stylesheets/style.scss" 6 | 7 | const Layout = ({ children }) => { 8 | return ( 9 |
10 |
11 | 12 | 19 | 20 |
21 |
{children}
22 |
23 |
24 | ) 25 | } 26 | 27 | export default Layout 28 | -------------------------------------------------------------------------------- /examples/starter-blog/src/components/seo.js: -------------------------------------------------------------------------------- 1 | /** 2 | * SEO component that queries for data with 3 | * Gatsby's useStaticQuery React hook 4 | * 5 | * See: https://www.gatsbyjs.org/docs/use-static-query/ 6 | */ 7 | 8 | import React from "react" 9 | import PropTypes from "prop-types" 10 | import Helmet from "react-helmet" 11 | import { useStaticQuery, graphql } from "gatsby" 12 | 13 | function SEO({ description, lang, meta, keywords, title }) { 14 | const { site } = useStaticQuery( 15 | graphql` 16 | query { 17 | site { 18 | siteMetadata { 19 | title 20 | description 21 | author 22 | } 23 | } 24 | } 25 | ` 26 | ) 27 | 28 | const metaDescription = description || site.siteMetadata.description 29 | 30 | return ( 31 | 0 73 | ? { 74 | name: `keywords`, 75 | content: keywords.join(`, `), 76 | } 77 | : [] 78 | ) 79 | .concat(meta)} 80 | /> 81 | ) 82 | } 83 | 84 | SEO.defaultProps = { 85 | lang: `en`, 86 | meta: [], 87 | keywords: [], 88 | description: ``, 89 | } 90 | 91 | SEO.propTypes = { 92 | description: PropTypes.string, 93 | lang: PropTypes.string, 94 | meta: PropTypes.arrayOf(PropTypes.object), 95 | keywords: PropTypes.arrayOf(PropTypes.string), 96 | title: PropTypes.string.isRequired, 97 | } 98 | 99 | export default SEO 100 | -------------------------------------------------------------------------------- /examples/starter-blog/src/pages/404.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { graphql } from "gatsby" 3 | 4 | import Layout from "../components/layout" 5 | import SEO from "../components/seo" 6 | 7 | class NotFoundPage extends React.Component { 8 | render() { 9 | const { data } = this.props 10 | const siteTitle = data.site.siteMetadata.title 11 | 12 | return ( 13 | 14 | 15 |

Not Found

16 |

You just hit a route that doesn't exist... the sadness.

17 |
18 | ) 19 | } 20 | } 21 | 22 | export default NotFoundPage 23 | 24 | export const pageQuery = graphql` 25 | query { 26 | site { 27 | siteMetadata { 28 | title 29 | } 30 | } 31 | } 32 | ` 33 | -------------------------------------------------------------------------------- /examples/starter-blog/src/pages/index.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { graphql } from "gatsby" 3 | import { Container } from "react-bootstrap" 4 | import PostsList from "../components/PostsList" 5 | import Layout from "../components/layout" 6 | import SEO from "../components/seo" 7 | 8 | const BlogIndex = ({ data, location }) => { 9 | const siteTitle = data.site.siteMetadata.title 10 | const posts = data.allMarkdownRemark.edges 11 | 12 | return ( 13 | 14 | 18 | 19 | 20 | 21 | 22 | ) 23 | } 24 | 25 | export const pageQuery = graphql` 26 | query { 27 | site { 28 | siteMetadata { 29 | title 30 | } 31 | } 32 | allMarkdownRemark(sort: { fields: [frontmatter___date], order: DESC }) { 33 | edges { 34 | node { 35 | excerpt 36 | fields { 37 | slug 38 | } 39 | frontmatter { 40 | date(formatString: "MMMM DD, YYYY") 41 | title 42 | description 43 | } 44 | } 45 | } 46 | } 47 | } 48 | ` 49 | 50 | export default BlogIndex 51 | -------------------------------------------------------------------------------- /examples/starter-blog/src/templates/blog-post.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { Link, graphql } from "gatsby" 3 | import { Container, Row, Col, Card } from "react-bootstrap" 4 | 5 | import Layout from "../components/layout" 6 | import SEO from "../components/seo" 7 | 8 | const BlogPostTemplate = ({ location, data, pageContext }) => { 9 | const post = data.markdownRemark 10 | const siteTitle = data.site.siteMetadata.title 11 | const { previous, next } = pageContext 12 | 13 | return ( 14 | 15 | 19 | 20 | 21 | 22 |
23 |

{post.frontmatter.title}

24 | 25 |
26 |

Posted on {post.frontmatter.date}

27 | 28 |
29 | 30 | 35 | 36 |
37 | 38 |
39 |
40 | 41 | 42 | 43 | {post.fields.category && ( 44 | 45 | Filed Under 46 | 47 | 48 | {post.fields.category} 49 | 50 | 51 | 52 | )} 53 | {post.fields.tags && ( 54 | 55 | Tags 56 | 57 | {post.fields.tags.map(tag => ( 58 | 62 | {tag} 63 | 64 | ))} 65 | 66 | 67 | )} 68 | 69 | See our other posts 70 | 71 | {previous && ( 72 | 77 | ← {previous.frontmatter.title} 78 | 79 | )} 80 | 81 | {next && ( 82 | 87 | {next.frontmatter.title} → 88 | 89 | )} 90 | 91 | 92 | 93 |
94 |
95 |
96 | ) 97 | } 98 | 99 | export const pageQuery = graphql` 100 | query BlogPostBySlug($slug: String!) { 101 | site { 102 | siteMetadata { 103 | title 104 | author 105 | } 106 | } 107 | markdownRemark(fields: { slug: { eq: $slug } }) { 108 | id 109 | excerpt(pruneLength: 160) 110 | html 111 | frontmatter { 112 | title 113 | date(formatString: "MMMM DD, YYYY") 114 | description 115 | } 116 | fields { 117 | category 118 | tags 119 | } 120 | } 121 | } 122 | ` 123 | 124 | export default BlogPostTemplate 125 | -------------------------------------------------------------------------------- /examples/starter-blog/src/templates/category.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { graphql } from "gatsby" 3 | import { Container } from "react-bootstrap" 4 | 5 | import Layout from "../components/layout" 6 | import SEO from "../components/seo" 7 | import PostsList from "../components/PostsList" 8 | 9 | const CategoryTemplate = ({ location, pageContext, data }) => { 10 | const { category } = pageContext 11 | return ( 12 | 13 |
14 | 15 | 16 | 17 |

Category: {category}

18 | 19 |
20 |
21 |
22 | ) 23 | } 24 | 25 | export const pageQuery = graphql` 26 | query CategoryPage($category: String) { 27 | allMarkdownRemark( 28 | limit: 1000 29 | filter: { fields: { category: { eq: $category } } } 30 | ) { 31 | totalCount 32 | edges { 33 | node { 34 | fields { 35 | slug 36 | category 37 | } 38 | excerpt 39 | timeToRead 40 | frontmatter { 41 | title 42 | date 43 | } 44 | } 45 | } 46 | } 47 | } 48 | ` 49 | 50 | export default CategoryTemplate 51 | -------------------------------------------------------------------------------- /examples/starter-blog/src/templates/tag.js: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import { graphql } from "gatsby" 3 | import { Container } from "react-bootstrap" 4 | 5 | import Layout from "../components/layout" 6 | import SEO from "../components/seo" 7 | import PostsList from "../components/PostsList" 8 | 9 | const CategoryTemplate = ({ location, pageContext, data }) => { 10 | const { tag } = pageContext 11 | return ( 12 | 13 |
14 | 15 | 16 |

Tag: {tag}

17 | 18 |
19 |
20 |
21 | ) 22 | } 23 | 24 | export const pageQuery = graphql` 25 | query TagPage($tag: String) { 26 | allMarkdownRemark( 27 | limit: 1000 28 | filter: { fields: { tags: { in: [$tag] } } } 29 | ) { 30 | totalCount 31 | edges { 32 | node { 33 | fields { 34 | slug 35 | tags 36 | } 37 | excerpt 38 | timeToRead 39 | frontmatter { 40 | title 41 | date 42 | } 43 | } 44 | } 45 | } 46 | } 47 | ` 48 | 49 | export default CategoryTemplate 50 | -------------------------------------------------------------------------------- /examples/starter-blog/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmcfadzean/gatsby-pantry/0eaf71c5f8b73477fae786320c90955b70626366/examples/starter-blog/static/favicon.ico -------------------------------------------------------------------------------- /examples/starter-blog/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": { 3 | "publish": { 4 | "allowBranch": "master", 5 | "conventionalCommits": true, 6 | "message": "chore(release): publish %s" 7 | } 8 | }, 9 | "packages": [ 10 | "packages/*" 11 | ], 12 | "ignoreChanges": [ 13 | "**/__tests__/**", 14 | "**/*.md" 15 | ], 16 | "version": "2.3.7", 17 | "npmClient": "yarn", 18 | "registry": "https://registry.npmjs.org/" 19 | } 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-pantry", 3 | "private": true, 4 | "devDependencies": { 5 | "@babel/cli": "^7.6.3", 6 | "@babel/core": "^7.6.3", 7 | "@babel/preset-env": "^7.6.3", 8 | "babel-core": "^7.0.0-bridge.0", 9 | "babel-eslint": "^10.0.3", 10 | "babel-jest": "^24.5.0", 11 | "cross-env": "^6.0.3", 12 | "eslint": "^6.5.1", 13 | "eslint-config-airbnb-base": "^14.0.0", 14 | "eslint-config-prettier": "^6.4.0", 15 | "eslint-plugin-import": "^2.18.0", 16 | "eslint-plugin-prettier": "^3.1.1", 17 | "husky": "^3.0.8", 18 | "jest": "^24.5.0", 19 | "lerna": "^3.16.5", 20 | "lint-staged": "^9.4.2", 21 | "plop": "^2.3.0", 22 | "prettier": "^1.16.4" 23 | }, 24 | "scripts": { 25 | "release": "lerna publish", 26 | "watch": "lerna run watch --no-sort --stream --concurrency 999", 27 | "lerna:prepare": "lerna run prepare", 28 | "lint:js": "eslint --ext .js packages/**/src", 29 | "format:js": "prettier packages/**/src/* --write", 30 | "plop": "plop" 31 | }, 32 | "husky": { 33 | "hooks": { 34 | "pre-commit": "lint-staged" 35 | } 36 | }, 37 | "lint-staged": { 38 | "*.{js}": [ 39 | "yarn run lint:js", 40 | "git add" 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "comments": false, 3 | "presets": [ 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "targets": { 8 | "node": "current" 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /*.js 3 | !index.js 4 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [2.3.7](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.6...v2.3.7) (2019-10-20) 7 | 8 | **Note:** Version bump only for package gatsby-plugin-categories 9 | 10 | 11 | 12 | 13 | 14 | ## [2.3.6](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.5...v2.3.6) (2019-08-28) 15 | 16 | **Note:** Version bump only for package gatsby-plugin-categories 17 | 18 | 19 | 20 | 21 | 22 | ## [2.3.5](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.4...v2.3.5) (2019-07-25) 23 | 24 | **Note:** Version bump only for package gatsby-plugin-categories 25 | 26 | 27 | 28 | 29 | 30 | ## [2.3.4](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.3...v2.3.4) (2019-07-24) 31 | 32 | **Note:** Version bump only for package gatsby-plugin-categories 33 | 34 | 35 | 36 | 37 | 38 | ## [2.3.3](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.2...v2.3.3) (2019-07-15) 39 | 40 | **Note:** Version bump only for package gatsby-plugin-categories 41 | 42 | 43 | 44 | 45 | 46 | ## [2.3.2](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.1...v2.3.2) (2019-06-10) 47 | 48 | **Note:** Version bump only for package gatsby-plugin-categories 49 | 50 | 51 | 52 | 53 | 54 | ## [2.3.1](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.3.0...v2.3.1) (2019-05-28) 55 | 56 | **Note:** Version bump only for package gatsby-plugin-categories 57 | 58 | 59 | 60 | 61 | 62 | # [2.2.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.1.0...v2.2.0) (2019-03-18) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * don't try make categories if there aren't any ([70763b8](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/70763b8)) 68 | * tidying up ([48a3195](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/48a3195)) 69 | 70 | 71 | 72 | 73 | 74 | # [2.1.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v2.0.0...v2.1.0) (2019-02-07) 75 | 76 | 77 | ### Bug Fixes 78 | 79 | * Update createPages to work when some .md files don't have category set. ([#8](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/issues/8)) ([52724ac](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/52724ac)) 80 | 81 | 82 | 83 | 84 | 85 | # [2.0.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v1.2.0...v2.0.0) (2019-01-19) 86 | 87 | 88 | ### Features 89 | 90 | * more robust slugging and using fields instead of frontmatter ([3468aae](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/3468aae)) 91 | 92 | 93 | 94 | 95 | 96 | # [1.2.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v1.1.2...v1.2.0) (2018-10-31) 97 | 98 | **Note:** Version bump only for package gatsby-plugin-categories 99 | 100 | 101 | 102 | 103 | 104 | 105 | ## [1.1.2](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v1.1.1...v1.1.2) (2018-09-27) 106 | 107 | 108 | ### Bug Fixes 109 | 110 | * **gatsby-plugin-categories:** removed pointless set to array conversion ([71d2c9b](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/71d2c9b)) 111 | 112 | 113 | 114 | 115 | 116 | 117 | ## [1.1.1](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v1.1.0...v1.1.1) (2018-08-18) 118 | 119 | 120 | ### Bug Fixes 121 | 122 | * kebabCased tags & categories ([1ca7478](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/1ca7478)) 123 | 124 | 125 | 126 | 127 | 128 | 129 | # [1.1.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/compare/v1.0.4...v1.1.0) (2018-08-18) 130 | 131 | 132 | ### Bug Fixes 133 | 134 | * bump categories -> 1.0.4 ([262b4a1](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/262b4a1)) 135 | * fixed version ([d1f7d2a](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/d1f7d2a)) 136 | 137 | 138 | ### Features 139 | 140 | * added gatsby-plugin-categories ([acfce6f](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories/commit/acfce6f)) 141 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Rob McFadzean 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-plugin-categories 2 | 3 | **DEPRECATED/UNSUPPORTED but PRs are welcome** 4 | 5 | Gatsby plugin to automatically create index pages for tagged content 6 | 7 | ## Install 8 | 9 | `yarn add gatsby-plugin-categories` 10 | 11 | ## How to use 12 | 13 | See [the example](https://github.com/rmcfadzean/gatsby-pantry/tree/master/examples/starter-blog#readme) 14 | 15 | ### Options 16 | 17 | You can view the defaults in [`defaults.js`](https://github.com/rmcfadzean/gatsby-pantry/blob/master/packages/gatsby-plugin-categories/src/defaults.js) 18 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/index.js: -------------------------------------------------------------------------------- 1 | // noop 2 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-plugin-categories", 3 | "description": "Gatsby plugin to automatically create index pages for categories of content", 4 | "version": "2.3.7", 5 | "author": "Rob Mcfadzean ", 6 | "keywords": [ 7 | "gatsby", 8 | "gatsby-plugin", 9 | "tags" 10 | ], 11 | "license": "MIT", 12 | "main": "index.js", 13 | "files": [ 14 | "/*.js" 15 | ], 16 | "peerDependencies": { 17 | "gatsby": ">2.0.0-beta" 18 | }, 19 | "scripts": { 20 | "build": "babel src --out-dir . --ignore '*/**/__tests__/'", 21 | "watch": "babel -w src --out-dir . --ignore '*/**/__tests__/'", 22 | "prepare": "cross-env NODE_ENV=production npm run build", 23 | "test": "jest" 24 | }, 25 | "bugs": { 26 | "url": "https://github.com/rmcfadzean/gatsby-pantry/issues" 27 | }, 28 | "homepage": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories#readme", 29 | "repository": { 30 | "type": "git", 31 | "url": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-categories" 32 | }, 33 | "dependencies": { 34 | "lodash": "^4.17.15", 35 | "slug": "^1.1.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/src/__tests__/internals.js: -------------------------------------------------------------------------------- 1 | import { pathify } from "../internals"; 2 | 3 | describe("pathify", () => { 4 | it("starts with a slash", () => { 5 | expect(pathify("abc")).toEqual("/abc/"); 6 | }); 7 | it("accepts a prefix", () => { 8 | expect(pathify("/foo", "abc")).toEqual("/foo/abc/"); 9 | }); 10 | it("accepts a prefix as slash", () => { 11 | expect(pathify("/", "abc")).toEqual("/abc/"); 12 | }); 13 | it("accepts many inputs", () => { 14 | expect(pathify("abc", "foobar")).toEqual("/abc/foobar/"); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/src/defaults.js: -------------------------------------------------------------------------------- 1 | export default { 2 | query: `{ 3 | allMarkdownRemark { 4 | edges { 5 | node { 6 | fields { 7 | category 8 | } 9 | } 10 | } 11 | } 12 | }`, 13 | prefix: "/category/", 14 | transformer: ({ data }) => 15 | data.allMarkdownRemark.edges.map(({ node }) => node), 16 | slugOptions: { 17 | lower: true 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/src/gatsby-node.js: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import slugify from "slug"; 3 | 4 | import defaultOptions from "./defaults"; 5 | import { pathify } from "./internals"; 6 | 7 | export const onCreateNode = ({ node, actions }, pluginOptions) => { 8 | const { createNodeField } = actions; 9 | if (node.internal.type === `MarkdownRemark`) { 10 | const { slugOptions } = { 11 | ...defaultOptions, 12 | ...pluginOptions 13 | }; 14 | const { 15 | frontmatter: { category } 16 | } = node; 17 | 18 | if (!category) return; 19 | 20 | createNodeField({ 21 | node, 22 | name: "category", 23 | value: slugify(category, { ...slugOptions }) 24 | }); 25 | } 26 | }; 27 | 28 | export const createPages = async ( 29 | { graphql, actions, reporter }, 30 | pluginOptions 31 | ) => { 32 | const { createPage } = actions; 33 | const { templatePath, prefix, query, transformer } = { 34 | ...defaultOptions, 35 | ...pluginOptions 36 | }; 37 | 38 | const data = await graphql(query); 39 | const pages = transformer(data); 40 | 41 | if (!templatePath) { 42 | reporter.panic(` 43 | "templatePath" is a required option for gatsby-plugin-categories 44 | `); 45 | } 46 | 47 | if (!fs.existsSync(templatePath)) { 48 | reporter.panic(` 49 | The template path passed to gatsby-plugin-categories does not exist 50 | ${templatePath} 51 | `); 52 | } 53 | 54 | const categorySet = new Set(); 55 | 56 | pages.forEach(({ fields }) => { 57 | if (fields && fields.category) { 58 | categorySet.add(fields.category); 59 | } 60 | }); 61 | 62 | categorySet.forEach(category => { 63 | createPage({ 64 | path: pathify(prefix, category), 65 | component: templatePath, 66 | context: { 67 | category 68 | } 69 | }); 70 | }); 71 | }; 72 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-categories/src/internals.js: -------------------------------------------------------------------------------- 1 | import { join, remove, trim, isEmpty } from "lodash"; 2 | 3 | const pathify = (...args) => { 4 | const parsedArgs = remove(args.map(arg => trim(arg, "/")), a => !isEmpty(a)); 5 | return `/${join(parsedArgs, "/")}/`; 6 | }; 7 | 8 | export { pathify }; 9 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "comments": false, 3 | "presets": [ 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "targets": { 8 | "node": "current" 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /*.js 3 | !index.js 4 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [2.3.7](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.6...v2.3.7) (2019-10-20) 7 | 8 | **Note:** Version bump only for package gatsby-plugin-tags 9 | 10 | 11 | 12 | 13 | 14 | ## [2.3.6](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.5...v2.3.6) (2019-08-28) 15 | 16 | **Note:** Version bump only for package gatsby-plugin-tags 17 | 18 | 19 | 20 | 21 | 22 | ## [2.3.5](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.4...v2.3.5) (2019-07-25) 23 | 24 | **Note:** Version bump only for package gatsby-plugin-tags 25 | 26 | 27 | 28 | 29 | 30 | ## [2.3.4](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.3...v2.3.4) (2019-07-24) 31 | 32 | **Note:** Version bump only for package gatsby-plugin-tags 33 | 34 | 35 | 36 | 37 | 38 | ## [2.3.3](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.2...v2.3.3) (2019-07-15) 39 | 40 | **Note:** Version bump only for package gatsby-plugin-tags 41 | 42 | 43 | 44 | 45 | 46 | ## [2.3.2](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.1...v2.3.2) (2019-06-10) 47 | 48 | **Note:** Version bump only for package gatsby-plugin-tags 49 | 50 | 51 | 52 | 53 | 54 | ## [2.3.1](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.3.0...v2.3.1) (2019-05-28) 55 | 56 | **Note:** Version bump only for package gatsby-plugin-tags 57 | 58 | 59 | 60 | 61 | 62 | # [2.3.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.2.0...v2.3.0) (2019-04-04) 63 | 64 | 65 | ### Bug Fixes 66 | 67 | * building tags should work again... oops ([6e6c97e](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/6e6c97e)) 68 | 69 | 70 | 71 | 72 | 73 | # [2.2.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.1.0...v2.2.0) (2019-03-18) 74 | 75 | 76 | ### Bug Fixes 77 | 78 | * removed githead ([9dde763](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/9dde763)) 79 | * tidying up ([48a3195](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/48a3195)) 80 | 81 | 82 | 83 | 84 | 85 | # [2.1.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v2.0.0...v2.1.0) (2019-02-07) 86 | 87 | 88 | ### Bug Fixes 89 | 90 | * Don't crash when some .md files dont have tags either. ([070e03d](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/070e03d)) 91 | * removed an accidentally commited directory ([6ec69ca](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/6ec69ca)) 92 | 93 | 94 | 95 | 96 | 97 | # [2.0.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.2.0...v2.0.0) (2019-01-19) 98 | 99 | 100 | ### Features 101 | 102 | * more robust slugging and using fields instead of frontmatter ([3468aae](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/3468aae)) 103 | 104 | 105 | 106 | 107 | 108 | # [1.2.0](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.1.2...v1.2.0) (2018-10-31) 109 | 110 | **Note:** Version bump only for package gatsby-plugin-tags 111 | 112 | 113 | 114 | 115 | 116 | 117 | ## [1.1.2](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.1.1...v1.1.2) (2018-09-27) 118 | 119 | 120 | ### Bug Fixes 121 | 122 | * **gatsby-plugin-tags:** no longer missing tags ([8fb9af7](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/8fb9af7)) 123 | 124 | 125 | 126 | 127 | 128 | 129 | ## [1.1.1](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.1.0...v1.1.1) (2018-08-18) 130 | 131 | 132 | ### Bug Fixes 133 | 134 | * kebabCased tags & categories ([1ca7478](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/1ca7478)) 135 | 136 | 137 | 138 | 139 | 140 | 141 | ## [1.0.4](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.0.3...v1.0.4) (2018-08-18) 142 | 143 | **Note:** Version bump only for package gatsby-plugin-tags 144 | 145 | 146 | 147 | 148 | 149 | 150 | ## [1.0.3](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/compare/v1.0.2...v1.0.3) (2018-08-18) 151 | 152 | 153 | ### Bug Fixes 154 | 155 | * added metadata to package.json ([389e8be](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags/commit/389e8be)) 156 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Rob McFadzean 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-plugin-tags 2 | 3 | **DEPRECATED/UNSUPPORTED but PRs are welcome** 4 | 5 | Gatsby plugin to automatically create index pages for tagged content 6 | 7 | ## Install 8 | 9 | `yarn add gatsby-plugin-tags` 10 | 11 | ## How to use 12 | 13 | See [the example](https://github.com/rmcfadzean/gatsby-pantry/tree/master/examples/starter-blog#readme) 14 | 15 | ### Options 16 | 17 | You can view the defaults in [`defaults.js`](https://github.com/rmcfadzean/gatsby-pantry/blob/master/packages/gatsby-plugin-tags/src/defaults.js) 18 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/index.js: -------------------------------------------------------------------------------- 1 | // noop 2 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-plugin-tags", 3 | "description": "Gatsby plugin to automatically create index pages for tagged content", 4 | "version": "2.3.7", 5 | "author": "Rob Mcfadzean ", 6 | "keywords": [ 7 | "gatsby", 8 | "gatsby-plugin", 9 | "tags" 10 | ], 11 | "license": "MIT", 12 | "main": "index.js", 13 | "files": [ 14 | "/*.js" 15 | ], 16 | "peerDependencies": { 17 | "gatsby": ">2.0.0-beta" 18 | }, 19 | "scripts": { 20 | "build": "babel src --out-dir . --ignore '*/**/__tests__/'", 21 | "watch": "babel -w src --out-dir . --ignore '*/**/__tests__/'", 22 | "prepare": "cross-env NODE_ENV=production npm run build" 23 | }, 24 | "bugs": { 25 | "url": "https://github.com/rmcfadzean/gatsby-pantry/issues" 26 | }, 27 | "homepage": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags#readme", 28 | "repository": { 29 | "type": "git", 30 | "url": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-plugin-tags" 31 | }, 32 | "dependencies": { 33 | "lodash": "^4.17.15", 34 | "slug": "^1.1.0" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/src/__tests__/internals.js: -------------------------------------------------------------------------------- 1 | import { pathify } from "../internals"; 2 | 3 | describe("pathify", () => { 4 | it("starts with a slash", () => { 5 | expect(pathify("abc")).toEqual("/abc/"); 6 | }); 7 | it("accepts a prefix", () => { 8 | expect(pathify("/foo", "abc")).toEqual("/foo/abc/"); 9 | }); 10 | it("accepts a prefix as slash", () => { 11 | expect(pathify("/", "abc")).toEqual("/abc/"); 12 | }); 13 | it("accepts many inputs", () => { 14 | expect(pathify("abc", "foobar")).toEqual("/abc/foobar/"); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/src/defaults.js: -------------------------------------------------------------------------------- 1 | export default { 2 | query: ` 3 | { 4 | allMarkdownRemark { 5 | edges { 6 | node { 7 | fields { 8 | tags 9 | } 10 | } 11 | } 12 | } 13 | } 14 | `, 15 | prefix: "/tags/", 16 | transformer: ({ data }) => 17 | data.allMarkdownRemark.edges.map(({ node }) => node), 18 | slugOptions: { 19 | lower: true 20 | } 21 | }; 22 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/src/gatsby-node.js: -------------------------------------------------------------------------------- 1 | import fs from "fs"; 2 | import slugify from "slug"; 3 | 4 | import defaultOptions from "./defaults"; 5 | import { pathify } from "./internals"; 6 | 7 | export const onCreateNode = ({ node, actions }, pluginOptions) => { 8 | const { createNodeField } = actions; 9 | if (node.internal.type === `MarkdownRemark`) { 10 | const { slugOptions } = { 11 | ...defaultOptions, 12 | ...pluginOptions 13 | }; 14 | const { 15 | frontmatter: { tags } 16 | } = node; 17 | 18 | if (!tags) return; 19 | 20 | createNodeField({ 21 | node, 22 | name: "tags", 23 | value: tags.map(tag => slugify(tag, { ...slugOptions })) 24 | }); 25 | } 26 | }; 27 | export const createPages = async ( 28 | { graphql, actions, reporter }, 29 | pluginOptions 30 | ) => { 31 | const { createPage } = actions; 32 | const { templatePath, prefix, query, transformer } = { 33 | ...defaultOptions, 34 | ...pluginOptions 35 | }; 36 | 37 | const data = await graphql(query); 38 | const pages = transformer(data); 39 | 40 | if (!templatePath) { 41 | reporter.panic(` 42 | "templatePath" is a required option for gatsby-plugin-tags 43 | `); 44 | } 45 | 46 | if (!fs.existsSync(templatePath)) { 47 | reporter.panic(` 48 | The template path passed to gatsby-plugin-tags does not exist 49 | ${templatePath} 50 | `); 51 | } 52 | 53 | const tagSet = new Set(); 54 | 55 | pages.forEach(({ fields }) => { 56 | if (fields && fields.tags) { 57 | fields.tags.forEach(tag => tagSet.add(tag)); 58 | } 59 | }); 60 | 61 | tagSet.forEach(tag => { 62 | createPage({ 63 | path: pathify(prefix, tag), 64 | component: templatePath, 65 | context: { 66 | tag 67 | } 68 | }); 69 | }); 70 | }; 71 | -------------------------------------------------------------------------------- /packages/gatsby-plugin-tags/src/internals.js: -------------------------------------------------------------------------------- 1 | import { join, remove, trim, isEmpty } from "lodash"; 2 | 3 | const pathify = (...args) => { 4 | const parsedArgs = remove(args.map(arg => trim(arg, "/")), a => !isEmpty(a)); 5 | return `/${join(parsedArgs, "/")}/`; 6 | }; 7 | 8 | export { pathify }; 9 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "comments": false, 3 | "presets": [ 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "targets": { 8 | "node": "current" 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /*.js 3 | !index.js 4 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to this project will be documented in this file. 4 | See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. 5 | 6 | ## [2.3.7](https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-source-all-contributors/compare/v2.3.6...v2.3.7) (2019-10-20) 7 | 8 | **Note:** Version bump only for package gatsby-source-all-contributors 9 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Rob Mcfadzean 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/README.md: -------------------------------------------------------------------------------- 1 | # gatsby-source-all-contributors 2 | 3 | **DEPRECATED/UNSUPPORTED but PRs are welcome** 4 | 5 | ## Install 6 | 7 | `npm install --save gatsby-source-all-contributors` 8 | 9 | ## How to use 10 | 11 | ```javascript 12 | // gatsby-config.js 13 | 14 | module.exports = { 15 | plugins: [ 16 | "gatsby-source-all-contributors" 17 | ], 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/index.js: -------------------------------------------------------------------------------- 1 | // noop 2 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gatsby-source-all-contributors", 3 | "description": "Gatsby plugin - TODO", 4 | "version": "2.3.7", 5 | "author": "Rob Mcfadzean ", 6 | "keywords": [ 7 | "gatsby", 8 | "gatsby-plugin", 9 | "tags" 10 | ], 11 | "license": "MIT", 12 | "main": "index.js", 13 | "files": [ 14 | "/*.js" 15 | ], 16 | "peerDependencies": { 17 | "gatsby": ">2.0.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/cli": "^7.0.0", 21 | "@babel/core": "^7.0.0", 22 | "@babel/preset-env": "^7.0.0", 23 | "cross-env": "^6.0.3" 24 | }, 25 | "scripts": { 26 | "build": "babel src --out-dir .", 27 | "watch": "babel -w src --out-dir .", 28 | "prepare": "cross-env NODE_ENV=production npm run build" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/rmcfadzean/gatsby-pantry/issues" 32 | }, 33 | "homepage": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-source-all-contributors#readme", 34 | "repository": { 35 | "type": "git", 36 | "url": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/gatsby-source-all-contributors" 37 | }, 38 | "dependencies": { 39 | "fs-extra": "^8.1.0", 40 | "gatsby-node-helpers": "^0.3.0", 41 | "gatsby-source-filesystem": "^2.1.33" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmcfadzean/gatsby-pantry/0eaf71c5f8b73477fae786320c90955b70626366/packages/gatsby-source-all-contributors/src/.gitkeep -------------------------------------------------------------------------------- /packages/gatsby-source-all-contributors/src/gatsby-node.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-param-reassign */ 2 | /* eslint-disable import/prefer-default-export */ 3 | import { createRemoteFileNode } from "gatsby-source-filesystem"; 4 | import fs from "fs-extra"; 5 | import path from "path"; 6 | 7 | export const sourceNodes = async (gatsby, pluginOptions = {}) => { 8 | const { 9 | actions, 10 | createNodeId, 11 | createContentDigest, 12 | store, 13 | cache, 14 | reporter 15 | } = gatsby; 16 | const { createNode } = actions; 17 | 18 | const { rcPath = "./.all-contributorsrc" } = pluginOptions; 19 | 20 | const contributorsRcPath = path.resolve(rcPath); 21 | 22 | const contributorsRcData = await fs.readFile(contributorsRcPath, "utf-8"); 23 | 24 | const { contributors } = JSON.parse(contributorsRcData); 25 | 26 | await Promise.all( 27 | contributors.map(async contributor => { 28 | const id = createNodeId(`contributors__${contributor.login}`); 29 | let fileNode; 30 | try { 31 | fileNode = await createRemoteFileNode({ 32 | url: contributor.avatar_url, 33 | parentNodeId: id, 34 | store, 35 | cache, 36 | ext: ".jpg", 37 | createNode, 38 | createNodeId, 39 | reporter 40 | }); 41 | } catch (e) { 42 | reporter.panic(e); 43 | } 44 | 45 | if (fileNode) { 46 | contributor.avatar___NODE = fileNode.id; 47 | } 48 | 49 | const nodeContent = JSON.stringify(contributor); 50 | 51 | const nodeMeta = { 52 | id, 53 | internal: { 54 | type: `Contributor`, 55 | content: nodeContent, 56 | contentDigest: createContentDigest(contributor) 57 | } 58 | }; 59 | 60 | const node = { ...contributor, ...nodeMeta }; 61 | 62 | createNode(node); 63 | }) 64 | ); 65 | }; 66 | -------------------------------------------------------------------------------- /plop-templates/plugin/.babelrc.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "comments": false, 3 | "presets": [ 4 | [ 5 | "@babel/preset-env", 6 | { 7 | "targets": { 8 | "node": "current" 9 | } 10 | } 11 | ] 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /plop-templates/plugin/.gitignore.hbs: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /*.js 3 | !index.js 4 | -------------------------------------------------------------------------------- /plop-templates/plugin/LICENSE.hbs: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 {{{ author }}} 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /plop-templates/plugin/README.md.hbs: -------------------------------------------------------------------------------- 1 | # {{ name }} 2 | 3 | TODO 4 | 5 | ## Install 6 | 7 | `npm install --save {{ name }}` 8 | 9 | ## How to use 10 | 11 | ```javascript 12 | // gatsby-config.js 13 | 14 | module.exports = { 15 | plugins: [ 16 | "{{ name }}" 17 | ], 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /plop-templates/plugin/index.js.hbs: -------------------------------------------------------------------------------- 1 | // noop 2 | -------------------------------------------------------------------------------- /plop-templates/plugin/package.json.hbs: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ name }}", 3 | "description": "Gatsby plugin - TODO", 4 | "version": "1.0.0", 5 | "author": "{{{ author }}}", 6 | "keywords": [ 7 | "gatsby", 8 | "gatsby-plugin", 9 | "tags" 10 | ], 11 | "license": "MIT", 12 | "main": "index.js", 13 | "files": [ 14 | "/*.js" 15 | ], 16 | "peerDependencies": { 17 | "gatsby": ">2.0.0" 18 | }, 19 | "devDependencies": { 20 | "@babel/cli": "^7.0.0", 21 | "@babel/core": "^7.0.0", 22 | "@babel/preset-env": "^7.0.0", 23 | "cross-env": "^5.2.0" 24 | }, 25 | "scripts": { 26 | "build": "babel src --out-dir .", 27 | "watch": "babel -w src --out-dir .", 28 | "prepare": "cross-env NODE_ENV=production npm run build" 29 | }, 30 | "bugs": { 31 | "url": "https://github.com/rmcfadzean/gatsby-pantry/issues" 32 | }, 33 | "homepage": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/{{name}}#readme", 34 | "repository": { 35 | "type": "git", 36 | "url": "https://github.com/rmcfadzean/gatsby-pantry/tree/master/packages/{{name}}" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /plop-templates/plugin/src/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmcfadzean/gatsby-pantry/0eaf71c5f8b73477fae786320c90955b70626366/plop-templates/plugin/src/.gitkeep -------------------------------------------------------------------------------- /plopfile.js: -------------------------------------------------------------------------------- 1 | module.exports = plop => { 2 | // Add new plugin 3 | plop.setGenerator("plugin", { 4 | description: "This is sets up the basic files for a new plugin.", 5 | prompts: [ 6 | { 7 | type: "input", 8 | name: "name", 9 | message: "name of new plugin (include the `gatsby-plugin-` prefix)", 10 | default: "testing" 11 | }, 12 | { 13 | type: "input", 14 | name: "author", 15 | message: 16 | "Your name/email for putting in the package.json of the new package", 17 | default: "Rob Mcfadzean " 18 | } 19 | ], 20 | actions: [ 21 | { 22 | type: "add", 23 | path: "packages/{{kebabCase name}}/package.json", 24 | templateFile: "plop-templates/plugin/package.json.hbs" 25 | }, 26 | { 27 | type: "add", 28 | path: "packages/{{kebabCase name}}/index.js", 29 | templateFile: "plop-templates/plugin/index.js.hbs" 30 | }, 31 | { 32 | type: "add", 33 | path: "packages/{{kebabCase name}}/README.md", 34 | templateFile: "plop-templates/plugin/README.md.hbs" 35 | }, 36 | { 37 | type: "add", 38 | path: "packages/{{kebabCase name}}/.babelrc", 39 | templateFile: "plop-templates/plugin/.babelrc.hbs" 40 | }, 41 | { 42 | type: "add", 43 | path: "packages/{{kebabCase name}}/.gitignore", 44 | templateFile: "plop-templates/plugin/.gitignore.hbs" 45 | }, 46 | { 47 | type: "add", 48 | path: "packages/{{kebabCase name}}/LICENSE", 49 | templateFile: "plop-templates/plugin/LICENSE.hbs" 50 | }, 51 | { 52 | type: "add", 53 | path: "packages/{{kebabCase name}}/src/.gitkeep", 54 | templateFile: "plop-templates/plugin/src/.gitkeep" 55 | } 56 | ].filter(Boolean) 57 | }); 58 | }; 59 | --------------------------------------------------------------------------------