├── .gitignore
├── LICENSE
├── README.md
├── config.json
├── content
└── posts
│ ├── license.mdx
│ ├── lorem-ipsum.mdx
│ ├── markdown-syntax.mdx
│ ├── references.mdx
│ ├── rich-content-with-mdx.mdx
│ └── welcome.mdx
├── global.d.ts
├── jest.config.js
├── meta
├── authors.yml
└── tags.yml
├── netlify.toml
├── next-env.d.ts
├── next.config.js
├── package-lock.json
├── package.json
├── public
├── admin
│ ├── config.yml
│ └── index.html
├── favicon.ico
├── icon.png
├── images
│ └── 600x300.png
├── og_image.png
├── site.webmanifest
└── styles
│ ├── content.module.css
│ └── global.css
├── src
├── __tests__
│ └── pagination.test.ts
├── assets
│ ├── github-alt.svg
│ └── twitter-alt.svg
├── components
│ ├── Author.tsx
│ ├── Burger.tsx
│ ├── Copyright.tsx
│ ├── Date.tsx
│ ├── Layout.tsx
│ ├── Navigation.tsx
│ ├── Pagination.tsx
│ ├── PostItem.tsx
│ ├── PostLayout.tsx
│ ├── PostList.tsx
│ ├── SocialList.tsx
│ ├── TagButton.tsx
│ ├── TagLink.tsx
│ ├── TagPostList.tsx
│ └── meta
│ │ ├── BasicMeta.tsx
│ │ ├── JsonLdMeta.tsx
│ │ ├── OpenGraphMeta.tsx
│ │ └── TwitterCardMeta.tsx
├── lib
│ ├── authors.ts
│ ├── config.ts
│ ├── pagination.ts
│ ├── posts.ts
│ └── tags.ts
└── pages
│ ├── _app.tsx
│ ├── index.tsx
│ └── posts
│ ├── [post].tsx
│ ├── index.tsx
│ ├── page
│ └── [page].tsx
│ └── tags
│ └── [[...slug]].tsx
├── tsconfig.json
└── yarn.lock
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | .env*
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # dist
28 | /dist
29 |
30 | # Local Netlify folder
31 | .netlify
32 |
33 | # mdx
34 | .mdx-data
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright 2020 Takahiro Fujiwara
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | [](https://app.netlify.com/sites/nextjs-netlify-blog-template/deploys)
4 | [](https://nextjs.org/)
5 |
6 | Next.js blogging template for Netlify is a boilerplate for building blogs with only Netlify stacks.
7 |
8 | 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.
9 |
10 | Next.js blogging template for Netlify has already implemented these standard features for building blogs with only using Next.js and Netlify stacks.
11 |
12 | ## Demo
13 |
14 | Deploy on your environment by clicking here:
15 |
16 | [](https://app.netlify.com/start/deploy?repository=https://github.com/wutali/nextjs-netlify-blog-template&stack=cms)
17 |
18 | Or access the following demo site:
19 |
20 | [Next.js blog template for Netlify](https://nextjs-netlify-blog-template.netlify.app/)
21 |
22 | ## Features
23 |
24 | - **Tagging**: organizes content by tags
25 | - **Author**: displays author names who write a post
26 | - **Pagination**: limits the number of posts per page
27 | - **CMS**: built with CMS to allow editors modifying content with the quickest way
28 | - **SEO optimized**: built-in metadata like JSON-LD
29 | - **Shortcode**: extends content writing with React component like WordPress shortcodes
30 |
31 | ## Dependencies
32 |
33 | - [TypeScript](https://www.typescriptlang.org/)
34 | - [Next.js](https://nextjs.org/)
35 | - [Netlify](https://www.netlify.com/)
36 | - [MDX](https://mdxjs.com/)
37 |
38 | ## Getting started
39 |
40 | To create your blog using the template, open your terminal, `cd` into the directory you'd like to create the app in,
41 | and run the following command:
42 |
43 | ```
44 | npx create-next-app your-blog --example "https://github.com/wutali/nextjs-netlify-blog-template"
45 | ```
46 |
47 | After that, set up your project as following the Netlify blog:
48 |
49 | [A Step-by-Step Guide: Deploying on Netlify](https://www.netlify.com/blog/2016/09/29/a-step-by-step-guide-deploying-on-netlify/)
50 |
51 | ## Customization
52 |
53 | This template is just a template and a boilerplate in which users can customize anything after the project was cloned and started.
54 | The following instructions introduce common customization points like adding new metadata or applying a new design theme.
55 |
56 | ### Styling pages by a customized theme
57 |
58 | All source codes related to the blog are under [components](/src/components) and [pages](/src/pages) directory.
59 | You can modify it freely if you want to apply your design theme.
60 | All components use [styled-jsx](https://github.com/vercel/styled-jsx) and [css-modules](https://github.com/css-modules/css-modules) to define their styles, but you can choose any styling libraries for designing your theme.
61 |
62 | The directory tree containing the blog source code are described below:
63 |
64 | ```
65 | meta: yaml files defining metadata like authors or tags
66 | public: images, favicons and other static assets
67 | src
68 | ├── assets: other assets using inside of components
69 | ├── components: pieces of components consisting of pages
70 | ├── content: mdx files for each post page
71 | ├── lib: project libraries like data fetching or pagination
72 | └── pages: page components managing by Next.js
73 | ```
74 |
75 | ### Organizing content by categories
76 |
77 | The category metadata that associates with content have the same relationship with the authors' one.
78 | Then reference these implementations for adding new metadata:
79 |
80 | - [public/admin/config.yml](/public/admin/config.yml#L51): author metadata definition for Netlify CMS
81 | - [src/lib/authors.tsx](/src/lib/authors.ts): fetches metadata and defines utility functions for components
82 | - [meta/authors.yml](/src/meta/authors.yml): author content managed by Netlify CMS
83 | - [src/components/PostLayout.tsx](/src/components/PostLayout.tsx): displays author content for each page
84 |
85 | You understood they have four steps to add the category metadata on your project after you read the above source codes:
86 |
87 | 1. Define the category metadata on the above Netlify config file
88 | 2. Create an empty file named with `categories.yml` under [meta](/src/meta/) directory
89 | 3. Create a new module for fetching category metadata
90 | 4. Display the category metadata on [src/components/PostLayout.tsx](/src/components/PostLayout.tsx#L75) or other components you want
91 |
92 | It is all you have to do. After that, you can access Netlify CMS and create new categories at any time.
93 |
94 | ### Locale settings for Netlify CMS
95 |
96 | Modify [config.yml](/public/admin/config.yml) and
97 | [index.html](/public/admin/index.html) under [public/admin](/public/admin/) directory
98 | as following instructions:
99 |
100 | [Netlify CMS - Configuration Options #Locale](https://www.netlifycms.org/docs/configuration-options/#locale)
101 |
102 | ## References
103 |
104 | - [Netlify CMS Documentation](https://www.netlifycms.org/docs/intro/)
105 | - [Building a Markdown blog with Next 9.4 and Netlify](https://www.netlify.com/blog/2020/05/04/building-a-markdown-blog-with-next-9.4-and-netlify/)
106 | - [Hugo Theme - Codex](https://github.com/jakewies/hugo-theme-codex)
107 | - [Next.js Starter Template for TypeScript](https://github.com/vercel/next-learn-starter/tree/master/typescript-final)
108 | - [Building Blog with NextJS and Netlify CMS](https://dev.to/mefaba/building-blog-with-nextjs-and-netlify-cms-fom)
109 | - [Unicons](https://github.com/Iconscout/unicons)
110 |
111 | ## License
112 |
113 | MIT
114 |
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "base_url": "https://wutali-nextjs-netlify-blog.netlify.app",
3 | "site_title": "Next.js Netlify Blog",
4 | "site_description": "Next.js blog template for Netlify",
5 | "site_keywords": [
6 | {
7 | "keyword": "Next.js"
8 | },
9 | {
10 | "keyword": "Netlify"
11 | },
12 | {
13 | "keyword": "React"
14 | }
15 | ],
16 | "posts_per_page": 5,
17 | "twitter_account": "@my-account",
18 | "github_account": "wutali"
19 | }
--------------------------------------------------------------------------------
/content/posts/license.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | slug: license
3 | title: License
4 | date: 2020-06-08
5 | author: wutali
6 | tags:
7 | - license
8 | ---
9 |
10 | ## Next.js and netlify blog template is managed under the MIT license
11 |
12 | Copyright 2020 Takahiro Fujiwara
13 |
14 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
15 |
16 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19 |
--------------------------------------------------------------------------------
/content/posts/lorem-ipsum.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | slug: lorem-ipsum
3 | title: Lorem Ipsum
4 | date: 2020-06-03
5 | author: wutali
6 | tags:
7 | - mock
8 | ---
9 |
10 | ## The standard Lorem Ipsum passage
11 |
12 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
13 |
14 | ## written by Cicero in 45 BC
15 |
16 | "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
17 |
18 | ## 1914 translation by H. Rackham
19 |
20 | "But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?"
21 |
--------------------------------------------------------------------------------
/content/posts/markdown-syntax.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | slug: "markdown-syntax"
3 | title: "Markdown Syntax Guide"
4 | date: 2020-06-09
5 | author: wutali
6 | tags:
7 | - style
8 | - markdown
9 | ---
10 |
11 | This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in MDX.
12 |
13 | ## Headings
14 |
15 | The following HTML `
`—`
` elements represent six levels of section headings. `
` is the highest section level while `
` is the lowest.
16 |
17 | # H1
18 |
19 | ## H2
20 |
21 | ### H3
22 |
23 | #### H4
24 |
25 | ##### H5
26 |
27 | ###### H6
28 |
29 | ## Paragraph
30 |
31 | Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.
32 |
33 | Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.
34 |
35 | ## Images
36 |
37 | 
38 |
39 | ## Blockquotes
40 |
41 | The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations.
42 |
43 | #### Blockquote without attribution
44 |
45 | > Tiam, ad mint andaepu dandae nostion secatur sequo quae.
46 | > **Note** that you can use _Markdown syntax_ within a blockquote.
47 |
48 | #### Blockquote with attribution
49 |
50 | > Simplicity is the ultimate sophistication.
51 | >
52 | > Leonardo da Vinci
53 |
54 | ## Tables
55 |
56 | Tables aren't part of the core Markdown spec, but Hugo supports supports them out-of-the-box.
57 |
58 | | Name | Age |
59 | | ----- | --- |
60 | | Bob | 27 |
61 | | Alice | 23 |
62 |
63 | #### Inline Markdown within tables
64 |
65 |