This is a starter for Gatsby, a static website generator based on React. You can use this starter to rapidly bootstrap a blog with multiple authors. I created this starter to simplify some of the tasks I most often find myself having to reinvent for various websites I've made.
With Gatsby installed on your system, you can use the gatsby new
command to create a new blog based on this starter:
$ gatsby new blog https://github.com/emilyaviva/gatsby-starter-blog-multiple-authors
I use Yarn, though you can stick with NPM if you like. Run the yarn
command to get your yarn.lock
all right and proper.
You'll want to change your blogTitle
and linkPrefix
in the config.toml
file.
To add an author, create a directory under pages/authors
in the name of the author in kebab case (e.g. pages/authors/john-smith
). That directory should contain a bio.json
file that contains name
, email
, and bio
properties. The author's avatar should live at image.png
in the same directory. (Extending this to use JPEG files, or additional fields in the bio, etc. etc., are left as exercises to the dev.)
Posts should be placed in the pages/posts
directory. Each post should have its own subdirectory. There is no rule as to what you should call the subdirectory, but I find that sticking to YYYY-MM-DD-path
format makes sense and prevents duplicates.
Each post's subdirectory should contain, at minimum, an index.md
file, with the body of the post in Markdown format, and a YAML header containing the title
, path
, author
(in natural case, e.g. John Smith
), and date
(in YYYY-MM-DD
) format. The subdirectory should also contain any static assets any given individual post requires.
Adding features, e.g. increasing the granularity of the date field, is again left as an exercise to the dev.
In this starter, all the styling lives in stylesheets/main.scss
. Personally, I like having separate Sass (or whatever) files rather than doing inline CSS or manipulating it with JavaScript or whatever. Your tastes may vary.
This starter includes a script to generate an Atom feed of the blog's posts whenever the site is built. The feed is exported to atom.xml
. The script itself that generates the feed lives at scripts/buildFeed.js
and is called as a special post-build task from gatsby-node.js
.
Send your pull requests to this project's repository on GitHub.
The code of this starter is freely licensed under the MIT License. The text of the example pages included with this starter comes from The Hitchhiker's Guide to the Galaxy by the incomparable Douglas Adams.