├── .gitignore ├── src ├── blog │ ├── blog.json │ ├── 2020-01-11-one.njk │ ├── 2020-01-16-four.njk │ ├── 2020-01-17-five.njk │ ├── 2020-01-13-two.njk │ ├── 2020-01-19-six.njk │ ├── 2020-01-14-three.njk │ └── 2020-01-21-seven.njk ├── index.njk ├── _11ty │ ├── filters.js │ ├── .eleventy.js │ └── collections.js ├── _includes │ └── layouts │ │ ├── default.njk │ │ └── blog.njk ├── author-index.njk ├── blog-archives.njk └── author-archives.njk ├── package.json └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | _site 4 | -------------------------------------------------------------------------------- /src/blog/blog.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "Anonymous", 3 | "layout": "layouts/blog.njk" 4 | } 5 | -------------------------------------------------------------------------------- /src/blog/2020-01-11-one.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 1 3 | author: John Doe 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-16-four.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 4 3 | author: John Doe 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-17-five.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 5 3 | author: John Doe 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-13-two.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 2 3 | author: Homer Simpson 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-19-six.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 6 3 | author: Homer Simpson 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-14-three.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Article 3 3 | author: Homer Simpson 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/blog/2020-01-21-seven.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Seven (no author) 3 | # author: none 4 | --- 5 | 6 |

This is article "{{ title }}".

7 | -------------------------------------------------------------------------------- /src/index.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Home 3 | layout: layouts/default.njk 4 | --- 5 | 6 | 12 | -------------------------------------------------------------------------------- /src/_11ty/filters.js: -------------------------------------------------------------------------------- 1 | module.exports = (config) =>{ 2 | config.addFilter("isoString", dateObj => new Date(dateObj).toISOString()); 3 | config.addFilter("localeDateTime", (dateObj, dateStyle = "long") => new Date(dateObj).toLocaleDateString([], { dateStyle })); 4 | }; 5 | -------------------------------------------------------------------------------- /src/_11ty/.eleventy.js: -------------------------------------------------------------------------------- 1 | const collections = require("./collections"); 2 | const filters = require("./filters"); 3 | 4 | module.exports = eleventyConfig => { 5 | collections(eleventyConfig); 6 | filters(eleventyConfig); 7 | 8 | return { 9 | dir: { 10 | input: "src" 11 | } 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /src/_includes/layouts/default.njk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ renderData.title or title }} 5 | 10 | 11 | 12 | 13 |
14 | {{ content | safe }} 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/author-index.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Author archive 3 | layout: layouts/default.njk 4 | pagination: 5 | data: collections.authors 6 | size: Infinity 7 | permalink: "authors/" 8 | --- 9 | 10 |

{{ title }}

11 | 12 | {% for author in pagination.items %} 13 |

{{ author | safe }}

14 | {% endfor %} 15 | -------------------------------------------------------------------------------- /src/blog-archives.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Blog Archive 3 | layout: layouts/default.njk 4 | pagination: 5 | data: collections.blog 6 | size: Infinity 7 | alias: blogs 8 | reverse: true 9 | permalink: "blog/" 10 | --- 11 | 12 | 17 | -------------------------------------------------------------------------------- /src/_includes/layouts/blog.njk: -------------------------------------------------------------------------------- 1 | --- 2 | layout: layouts/default.njk 3 | --- 4 | 5 |
6 |
7 |

{{ title }}

8 |
9 | 10 | {{ content | safe }} 11 | 12 | 20 |
21 | -------------------------------------------------------------------------------- /src/_11ty/collections.js: -------------------------------------------------------------------------------- 1 | module.exports = (config) => { 2 | config.addCollection("authors", collection => { 3 | const blogs = collection.getFilteredByGlob("src/blog/*.njk"); 4 | return blogs.reduce((coll, post) => { 5 | const author = post.data.author; 6 | if (!author) { 7 | return coll; 8 | } 9 | if (!coll.hasOwnProperty(author)) { 10 | coll[author] = []; 11 | } 12 | coll[author].push(post.data); 13 | return coll; 14 | }, {}); 15 | }); 16 | config.addCollection("blog", collection => 17 | collection.getFilteredByGlob("src/blog/*.njk") 18 | ); 19 | }; -------------------------------------------------------------------------------- /src/author-archives.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: Author archive 3 | layout: layouts/default.njk 4 | pagination: 5 | data: collections.authors 6 | size: 1 7 | alias: author 8 | permalink: "authors/{{ author | slug }}/" 9 | renderData: 10 | author: "{{ author }}" 11 | title: "{{ author }} archives" 12 | --- 13 | 14 |

{{ renderData.title | safe }}

15 | 16 | 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "11ty-blog-authors", 3 | "version": "1.0.0", 4 | "author": "Peter deHaan", 5 | "bugs": { 6 | "url": "https://github.com/pdehaan/11ty-blog-authors/issues" 7 | }, 8 | "dependencies": { 9 | "@11ty/eleventy": "*", 10 | "rimraf": "*" 11 | }, 12 | "homepage": "https://github.com/pdehaan/11ty-blog-authors#readme", 13 | "keywords": [ 14 | "11ty", 15 | "eleventy" 16 | ], 17 | "license": "MPL-2.0", 18 | "main": "index.js", 19 | "private": true, 20 | "repository": { 21 | "type": "git", 22 | "url": "git+https://github.com/pdehaan/11ty-blog-authors.git" 23 | }, 24 | "scripts": { 25 | "build": "eleventy build --config=src/_11ty/.eleventy.js", 26 | "clean": "rimraf _site", 27 | "test": "echo \"Error: no test specified\" && exit 1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License, version 2.0 2 | 3 | 1. Definitions 4 | 5 | 1.1. “Contributor” 6 | means each individual or legal entity that creates, contributes to the 7 | creation of, or owns Covered Software. 8 | 9 | 1.2. “Contributor Version” 10 | means the combination of the Contributions of others (if any) used by a 11 | Contributor and that particular Contributor’s Contribution. 12 | 13 | 1.3. “Contribution” 14 | means Covered Software of a particular Contributor. 15 | 16 | 1.4. “Covered Software” 17 | means Source Code Form to which the initial Contributor has attached the 18 | notice in Exhibit A, the Executable Form of such Source Code Form, 19 | and Modifications of such Source Code Form, in each case 20 | including portions thereof. 21 | 22 | 1.5. “Incompatible With Secondary Licenses” 23 | means 24 | 25 | a. that the initial Contributor has attached the notice described 26 | in Exhibit B to the Covered Software; or 27 | 28 | b. that the Covered Software was made available under the terms of 29 | version 1.1 or earlier of the License, but not also under the terms 30 | of a Secondary License. 31 | 32 | 1.6. “Executable Form” 33 | means any form of the work other than Source Code Form. 34 | 35 | 1.7. “Larger Work” 36 | means a work that combines Covered Software with other material, 37 | in a separate file or files, that is not Covered Software. 38 | 39 | 1.8. “License” 40 | means this document. 41 | 42 | 1.9. “Licensable” 43 | means having the right to grant, to the maximum extent possible, 44 | whether at the time of the initial grant or subsequently, 45 | any and all of the rights conveyed by this License. 46 | 47 | 1.10. “Modifications” 48 | means any of the following: 49 | 50 | a. any file in Source Code Form that results from an addition to, 51 | deletion from, or modification of the contents of Covered Software; or 52 | 53 | b. any new file in Source Code Form that contains any Covered Software. 54 | 55 | 1.11. “Patent Claims” of a Contributor 56 | means any patent claim(s), including without limitation, method, process, 57 | and apparatus claims, in any patent Licensable by such Contributor that 58 | would be infringed, but for the grant of the License, by the making, 59 | using, selling, offering for sale, having made, import, or transfer of 60 | either its Contributions or its Contributor Version. 61 | 62 | 1.12. “Secondary License” 63 | means either the GNU General Public License, Version 2.0, the 64 | GNU Lesser General Public License, Version 2.1, the GNU Affero General 65 | Public License, Version 3.0, or any later versions of those licenses. 66 | 67 | 1.13. “Source Code Form” 68 | means the form of the work preferred for making modifications. 69 | 70 | 1.14. “You” (or “Your”) 71 | means an individual or a legal entity exercising rights under this License. 72 | For legal entities, “You” includes any entity that controls, 73 | is controlled by, or is under common control with You. For purposes of 74 | this definition, “control” means (a) the power, direct or indirect, 75 | to cause the direction or management of such entity, whether by contract 76 | or otherwise, or (b) ownership of more than fifty percent (50%) of the 77 | outstanding shares or beneficial ownership of such entity. 78 | 79 | 2. License Grants and Conditions 80 | 81 | 2.1. Grants 82 | Each Contributor hereby grants You a world-wide, royalty-free, 83 | non-exclusive license: 84 | 85 | a. under intellectual property rights (other than patent or trademark) 86 | Licensable by such Contributor to use, reproduce, make available, 87 | modify, display, perform, distribute, and otherwise exploit its 88 | Contributions, either on an unmodified basis, with Modifications, 89 | or as part of a Larger Work; and 90 | 91 | b. under Patent Claims of such Contributor to make, use, sell, 92 | offer for sale, have made, import, and otherwise transfer either 93 | its Contributions or its Contributor Version. 94 | 95 | 2.2. Effective Date 96 | The licenses granted in Section 2.1 with respect to any Contribution 97 | become effective for each Contribution on the date the Contributor 98 | first distributes such Contribution. 99 | 100 | 2.3. Limitations on Grant Scope 101 | The licenses granted in this Section 2 are the only rights granted 102 | under this License. No additional rights or licenses will be implied 103 | from the distribution or licensing of Covered Software under this License. 104 | Notwithstanding Section 2.1(b) above, no patent license is granted 105 | by a Contributor: 106 | 107 | a. for any code that a Contributor has removed from 108 | Covered Software; or 109 | 110 | b. for infringements caused by: (i) Your and any other third party’s 111 | modifications of Covered Software, or (ii) the combination of its 112 | Contributions with other software (except as part of its 113 | Contributor Version); or 114 | 115 | c. under Patent Claims infringed by Covered Software in the 116 | absence of its Contributions. 117 | 118 | This License does not grant any rights in the trademarks, service marks, 119 | or logos of any Contributor (except as may be necessary to comply with 120 | the notice requirements in Section 3.4). 121 | 122 | 2.4. Subsequent Licenses 123 | No Contributor makes additional grants as a result of Your choice to 124 | distribute the Covered Software under a subsequent version of this 125 | License (see Section 10.2) or under the terms of a Secondary License 126 | (if permitted under the terms of Section 3.3). 127 | 128 | 2.5. Representation 129 | Each Contributor represents that the Contributor believes its 130 | Contributions are its original creation(s) or it has sufficient rights 131 | to grant the rights to its Contributions conveyed by this License. 132 | 133 | 2.6. Fair Use 134 | This License is not intended to limit any rights You have under 135 | applicable copyright doctrines of fair use, fair dealing, 136 | or other equivalents. 137 | 138 | 2.7. Conditions 139 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the 140 | licenses granted in Section 2.1. 141 | 142 | 3. Responsibilities 143 | 144 | 3.1. Distribution of Source Form 145 | All distribution of Covered Software in Source Code Form, including 146 | any Modifications that You create or to which You contribute, must be 147 | under the terms of this License. You must inform recipients that the 148 | Source Code Form of the Covered Software is governed by the terms 149 | of this License, and how they can obtain a copy of this License. 150 | You may not attempt to alter or restrict the recipients’ rights 151 | in the Source Code Form. 152 | 153 | 3.2. Distribution of Executable Form 154 | If You distribute Covered Software in Executable Form then: 155 | 156 | a. such Covered Software must also be made available in Source Code 157 | Form, as described in Section 3.1, and You must inform recipients of 158 | the Executable Form how they can obtain a copy of such Source Code 159 | Form by reasonable means in a timely manner, at a charge no more than 160 | the cost of distribution to the recipient; and 161 | 162 | b. You may distribute such Executable Form under the terms of this 163 | License, or sublicense it under different terms, provided that the 164 | license for the Executable Form does not attempt to limit or alter 165 | the recipients’ rights in the Source Code Form under this License. 166 | 167 | 3.3. Distribution of a Larger Work 168 | You may create and distribute a Larger Work under terms of Your choice, 169 | provided that You also comply with the requirements of this License for 170 | the Covered Software. If the Larger Work is a combination of 171 | Covered Software with a work governed by one or more Secondary Licenses, 172 | and the Covered Software is not Incompatible With Secondary Licenses, 173 | this License permits You to additionally distribute such Covered Software 174 | under the terms of such Secondary License(s), so that the recipient of 175 | the Larger Work may, at their option, further distribute the 176 | Covered Software under the terms of either this License or such 177 | Secondary License(s). 178 | 179 | 3.4. Notices 180 | You may not remove or alter the substance of any license notices 181 | (including copyright notices, patent notices, disclaimers of warranty, 182 | or limitations of liability) contained within the Source Code Form of 183 | the Covered Software, except that You may alter any license notices to 184 | the extent required to remedy known factual inaccuracies. 185 | 186 | 3.5. Application of Additional Terms 187 | You may choose to offer, and to charge a fee for, warranty, support, 188 | indemnity or liability obligations to one or more recipients of 189 | Covered Software. However, You may do so only on Your own behalf, 190 | and not on behalf of any Contributor. You must make it absolutely clear 191 | that any such warranty, support, indemnity, or liability obligation is 192 | offered by You alone, and You hereby agree to indemnify every Contributor 193 | for any liability incurred by such Contributor as a result of warranty, 194 | support, indemnity or liability terms You offer. You may include 195 | additional disclaimers of warranty and limitations of liability 196 | specific to any jurisdiction. 197 | 198 | 4. Inability to Comply Due to Statute or Regulation 199 | 200 | If it is impossible for You to comply with any of the terms of this License 201 | with respect to some or all of the Covered Software due to statute, 202 | judicial order, or regulation then You must: (a) comply with the terms of 203 | this License to the maximum extent possible; and (b) describe the limitations 204 | and the code they affect. Such description must be placed in a text file 205 | included with all distributions of the Covered Software under this License. 206 | Except to the extent prohibited by statute or regulation, such description 207 | must be sufficiently detailed for a recipient of ordinary skill 208 | to be able to understand it. 209 | 210 | 5. Termination 211 | 212 | 5.1. The rights granted under this License will terminate automatically 213 | if You fail to comply with any of its terms. However, if You become 214 | compliant, then the rights granted under this License from a particular 215 | Contributor are reinstated (a) provisionally, unless and until such 216 | Contributor explicitly and finally terminates Your grants, and (b) on an 217 | ongoing basis, if such Contributor fails to notify You of the 218 | non-compliance by some reasonable means prior to 60 days after You have 219 | come back into compliance. Moreover, Your grants from a particular 220 | Contributor are reinstated on an ongoing basis if such Contributor 221 | notifies You of the non-compliance by some reasonable means, 222 | this is the first time You have received notice of non-compliance with 223 | this License from such Contributor, and You become compliant prior to 224 | 30 days after Your receipt of the notice. 225 | 226 | 5.2. If You initiate litigation against any entity by asserting a patent 227 | infringement claim (excluding declaratory judgment actions, 228 | counter-claims, and cross-claims) alleging that a Contributor Version 229 | directly or indirectly infringes any patent, then the rights granted 230 | to You by any and all Contributors for the Covered Software under 231 | Section 2.1 of this License shall terminate. 232 | 233 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 234 | end user license agreements (excluding distributors and resellers) which 235 | have been validly granted by You or Your distributors under this License 236 | prior to termination shall survive termination. 237 | 238 | 6. Disclaimer of Warranty 239 | 240 | Covered Software is provided under this License on an “as is” basis, without 241 | warranty of any kind, either expressed, implied, or statutory, including, 242 | without limitation, warranties that the Covered Software is free of defects, 243 | merchantable, fit for a particular purpose or non-infringing. The entire risk 244 | as to the quality and performance of the Covered Software is with You. 245 | Should any Covered Software prove defective in any respect, You 246 | (not any Contributor) assume the cost of any necessary servicing, repair, 247 | or correction. This disclaimer of warranty constitutes an essential part of 248 | this License. No use of any Covered Software is authorized under this 249 | License except under this disclaimer. 250 | 251 | 7. Limitation of Liability 252 | 253 | Under no circumstances and under no legal theory, whether tort 254 | (including negligence), contract, or otherwise, shall any Contributor, or 255 | anyone who distributes Covered Software as permitted above, be liable to 256 | You for any direct, indirect, special, incidental, or consequential damages 257 | of any character including, without limitation, damages for lost profits, 258 | loss of goodwill, work stoppage, computer failure or malfunction, or any and 259 | all other commercial damages or losses, even if such party shall have been 260 | informed of the possibility of such damages. This limitation of liability 261 | shall not apply to liability for death or personal injury resulting from 262 | such party’s negligence to the extent applicable law prohibits such 263 | limitation. Some jurisdictions do not allow the exclusion or limitation of 264 | incidental or consequential damages, so this exclusion and limitation may 265 | not apply to You. 266 | 267 | 8. Litigation 268 | 269 | Any litigation relating to this License may be brought only in the courts of 270 | a jurisdiction where the defendant maintains its principal place of business 271 | and such litigation shall be governed by laws of that jurisdiction, without 272 | reference to its conflict-of-law provisions. Nothing in this Section shall 273 | prevent a party’s ability to bring cross-claims or counter-claims. 274 | 275 | 9. Miscellaneous 276 | 277 | This License represents the complete agreement concerning the subject matter 278 | hereof. If any provision of this License is held to be unenforceable, 279 | such provision shall be reformed only to the extent necessary to make it 280 | enforceable. Any law or regulation which provides that the language of a 281 | contract shall be construed against the drafter shall not be used to construe 282 | this License against a Contributor. 283 | 284 | 10. Versions of the License 285 | 286 | 10.1. New Versions 287 | Mozilla Foundation is the license steward. Except as provided in 288 | Section 10.3, no one other than the license steward has the right to 289 | modify or publish new versions of this License. Each version will be 290 | given a distinguishing version number. 291 | 292 | 10.2. Effect of New Versions 293 | You may distribute the Covered Software under the terms of the version 294 | of the License under which You originally received the Covered Software, 295 | or under the terms of any subsequent version published 296 | by the license steward. 297 | 298 | 10.3. Modified Versions 299 | If you create software not governed by this License, and you want to 300 | create a new license for such software, you may create and use a modified 301 | version of this License if you rename the license and remove any 302 | references to the name of the license steward (except to note that such 303 | modified license differs from this License). 304 | 305 | 10.4. Distributing Source Code Form that is 306 | Incompatible With Secondary Licenses 307 | If You choose to distribute Source Code Form that is 308 | Incompatible With Secondary Licenses under the terms of this version of 309 | the License, the notice described in Exhibit B of this 310 | License must be attached. 311 | 312 | Exhibit A - Source Code Form License Notice 313 | 314 | This Source Code Form is subject to the terms of the 315 | Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed 316 | with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 317 | 318 | If it is not possible or desirable to put the notice in a particular file, 319 | then You may include the notice in a location (such as a LICENSE file in a 320 | relevant directory) where a recipient would be likely to 321 | look for such a notice. 322 | 323 | You may add additional accurate notices of copyright ownership. 324 | 325 | Exhibit B - “Incompatible With Secondary Licenses” Notice 326 | 327 | This Source Code Form is “Incompatible With Secondary Licenses”, 328 | as defined by the Mozilla Public License, v. 2.0. 329 | 330 | --------------------------------------------------------------------------------