Next.js blogging template for Netlify is a boilerplate for building blogs with only Netlify stacks.
There are some boilerplate or tutorials for the combination of Next.js and Netlify on GitHub. These resources have documentation and good tutorial to get started Next.js and Netlify quickly, but they are too simple to build blogs with standard features like tagging.
Next.js blogging template for Netlify has already implemented these standard features for building blogs with only using Next.js and Netlify stacks.
Deploy on your environment by clicking here:
Or access the following demo site:
Next.js blog template for Netlify
- Tagging: organizes content by tags
- Author: displays author names who write a post
- Pagination: limits the number of posts per page
- CMS: built with CMS to allow editors modifying content with the quickest way
- SEO optimized: built-in metadata like JSON-LD
- Shortcode: extends content writing with React component like WordPress shortcodes
To create your blog using the template, open your terminal, cd
into the directory you'd like to create the app in,
and run the following command:
npx create-next-app your-blog --example "https://github.com/wutali/nextjs-netlify-blog-template"
After that, set up your project as following the Netlify blog:
A Step-by-Step Guide: Deploying on Netlify
This template is just a template and a boilerplate in which users can customize anything after the project was cloned and started. The following instructions introduce common customization points like adding new metadata or applying a new design theme.
All source codes related to the blog are under components, pages, and layouts directory. You can modify it freely if you want to apply your design theme. All components use styled-jsx and css-modules to define their styles, but you can choose any styling libraries for designing your theme.
The directory tree containing the blog source code are described below:
meta: yaml files defining metadata like authors or tags
public: images, favicons and other static assets
src
├── assets: other assets using inside of components
├── components: pieces of components consisting of pages
├── layouts: layout components for each post page
├── lib: project libraries like data fetching or pagination
└── pages: page components managing by Next.js
The category metadata that associates with content have the same relationship with the authors' one. Then reference these implementations for adding new metadata:
- public/admin/config.yml: author metadata definition for Netlify CMS
- src/lib/authors.tsx: fetches metadata and defines utility functions for components
- meta/authors.yml: author content managed by Netlify CMS
- layouts/index.tsx: displays author content for each page
You understood they have four steps to add the category metadata on your project after you read the above source codes:
- Define the category metadata on the above Netlify config file
- Create an empty file named with
categories.yml
under meta directory - Create a new module for fetching category metadata
- Display the category metadata on layouts or other components you want
It is all you have to do. After that, you can access Netlify CMS and create new categories at any time.
Modify config.yml and index.html under public/admin directory as following instructions:
Netlify CMS - Configuration Options #Locale
- Netlify CMS Documentation
- Building a Markdown blog with Next 9.4 and Netlify
- Hugo Theme - Codex
- Next.js Starter Template for TypeScript
- Building Blog with NextJS and Netlify CMS
- Unicons
MIT