Joe Attardi

Using Gatsby and Netlify CMS

Build Blazing Fast JAMstack Apps Using Gatsby and Netlify CMS

1st ed.
Joe Attardi
Billerica, MA, USA
ISBN 978-1-4842-6296-2e-ISBN 978-1-4842-6297-9
© Joe Attardi 2020
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this publication does not imply, even in the absence of a specific statement, that such names are exempt from the relevant protective laws and regulations and therefore free for general use.
The publisher, the authors and the editors are safe to assume that the advice and information in this book are believed to be true and accurate at the date of publication. Neither the publisher nor the authors or the editors give a warranty, expressed or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The publisher remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Distributed to the book trade worldwide by Springer Science+Business Media New York, 1 New York Plaza, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.

To Liz and Benjamin – you are my whole world.

Introduction

In this book, you will learn all about creating a website using Gatsby, getting its content from Netlify CMS, a free content management system from Netlify. We’ll start with a bare-bones template project and install and configure Netlify CMS from scratch.

In Chapter 1, we’ll look at the Jamstack and what a content management system is. We’ll talk about headless CMSs and introduce Netlify CMS.

Chapter 2 is a Gatsby crash course. If you have built a site with Gatsby before, you can probably skip this chapter, as it is a very basic overview of Gatsby. Conversely, if you haven’t been exposed to Gatsby before, this introduction should be enough to get you going.

We’ll start setting up the example project, a coffee shop website, in Chapter 3. We’ll take care of signing up for GitHub and Netlify if you haven’t already and also get your version of the example project deployed on Netlify.

In Chapter 4, we’ll start adding Netlify CMS to the project. This covers installation of the CMS and creation of the configuration file. We’ll set up the blog content and integrate with the Netlify identity service.

In Chapter 5, we’ll take a tour of the CMS user interface, and create our first piece of content: a blog post. We’ll also look at how to add images to blog posts.

We’ll take the content created by the CMS and start integrating that with Gatsby in Chapter 6. We’ll configure some Gatsby plugins which will add the blog content to Gatsby’s data model.

Chapter 7 is all about creating pages from data. It will introduce the Gatsby Node APIs and show how Gatsby dynamically creates pages by combining data with a page template.

Eventually, we’ll end up with too much blog data to show on a single page, so in Chapter 8, we’ll learn how to paginate the blog posts. We’ll split the blog post listing into several pages (which are also dynamically created).

Up to now, the content on the landing page, such as the hero image and tagline, is managed in the source code. Chapter 9 will explore how to make this content dynamic and editable from Netlify CMS. We’ll make several elements of the landing page configurable from the CMS, allowing the page content to be updated without writing a line of code.

In Chapter 10, we’ll create a menu for the coffee shop. We’ll create new content definitions in the CMS configuration for menu categories, items, and prices.

Gatsby has some plugins that can help generate more efficient images to improve page load time. We’ll look at how to do this in Chapter 11.

In Chapter 12, we’ll see how we can customize the CMS user interface, extending it with a custom preview component so that we can see a live preview of how the menu looks from within the CMS.

Finally, in Chapter 13, we’ll look at how to leverage Netlify CMS’s editorial workflow, creating draft content and reviewing it via GitHub pull requests.

We’ll close the book in Chapter 14 with some discussion of Netlify CMS beta features and pointers to more Netlify CMS resources.

Acknowledgments

I’d like to start by thanking my wonderful wife, Liz, for her constant love and encouragement throughout the whole writing process – and for understanding when I locked myself away in solitude to write. And my little toddler, Benjamin, for giving me much needed breaks from writing for play time.

Thanks to all my friends and family for always supporting and encouraging my interest in computers and technology.

This book began its life as a self-published work, and I’d like to thank Apress for making it what it is today. I’d also like to thank the awesome team at Apress – Louise Corrigan, Nancy Chen, and Jim Markham – for guiding me through the process every step of the way. I appreciate their patience with me as a first-time author.

Thanks to Alexander Nnakwue, the technical reviewer for this book, for his time and excellent feedback, helping make this book even better.

Table of Contents
Index 197
About the Author
Joe Attardi
../images/502348_1_En_BookFrontmatter_Figb_HTML.jpg

is a software engineer specializing in front-end development. He has over 15 years’ experience working with JavaScript, HTML, and CSS and has worked extensively with front-end technologies such as Angular and React. He currently works at Salesforce and has worked in the past with companies such as Dell and Nortel. He is also the author of Modern CSS, an Apress title. He lives in the Boston area with his wife and son. You can find him on Twitter at @JoeAttardi.

 
About the Technical Reviewer
Alexander Nnakwue
../images/502348_1_En_BookFrontmatter_Figc_HTML.jpg

has a background in Mechanical Engineering from the University of Ibadan, Nigeria, and has been a front-end developer for over 3 years working on both web and mobile technologies. He also has experience as a technical author, writer, and reviewer. He enjoys programming for the Web, and occasionally, you can also find him playing soccer. He was born in Benin City and is currently based in Lagos, Nigeria.

 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.16.23