|
| 1 | +# A statically generated blog example using Next.js, Markdown, and TypeScript |
| 2 | + |
| 3 | +This is the existing [blog-starter](https://github.com/vercel/next.js/tree/canary/examples/blog-starter) plus TypeScript. |
| 4 | + |
| 5 | +This example showcases Next.js's [Static Generation](https://nextjs.org/docs/app/building-your-application/routing/layouts-and-templates) feature using Markdown files as the data source. |
| 6 | + |
| 7 | +The blog posts are stored in `/_posts` as Markdown files with front matter support. Adding a new Markdown file in there will create a new blog post. |
| 8 | + |
| 9 | +To create the blog posts we use [`remark`](https://github.com/remarkjs/remark) and [`remark-html`](https://github.com/remarkjs/remark-html) to convert the Markdown files into an HTML string, and then send it down as a prop to the page. The metadata of every post is handled by [`gray-matter`](https://github.com/jonschlinkert/gray-matter) and also sent in props to the page. |
| 10 | + |
| 11 | +## Demo |
| 12 | + |
| 13 | +[https://next-blog-starter.vercel.app/](https://next-blog-starter.vercel.app/) |
| 14 | + |
| 15 | +## Deploy your own |
| 16 | + |
| 17 | +Deploy the example using [Vercel](https://vercel.com?utm_source=github&utm_medium=readme&utm_campaign=next-example) or preview live with [StackBlitz](https://stackblitz.com/github/vercel/next.js/tree/canary/examples/blog-starter) |
| 18 | + |
| 19 | +[](https://vercel.com/new/clone?repository-url=https://github.com/vercel/next.js/tree/canary/examples/blog-starter&project-name=blog-starter&repository-name=blog-starter) |
| 20 | + |
| 21 | +### Related examples |
| 22 | + |
| 23 | +- [WordPress](/examples/cms-wordpress) |
| 24 | +- [DatoCMS](/examples/cms-datocms) |
| 25 | +- [Sanity](/examples/cms-sanity) |
| 26 | +- [TakeShape](/examples/cms-takeshape) |
| 27 | +- [Prismic](/examples/cms-prismic) |
| 28 | +- [Contentful](/examples/cms-contentful) |
| 29 | +- [Strapi](/examples/cms-strapi) |
| 30 | +- [Agility CMS](/examples/cms-agilitycms) |
| 31 | +- [Cosmic](/examples/cms-cosmic) |
| 32 | +- [ButterCMS](/examples/cms-buttercms) |
| 33 | +- [Storyblok](/examples/cms-storyblok) |
| 34 | +- [GraphCMS](/examples/cms-graphcms) |
| 35 | +- [Kontent](/examples/cms-kontent) |
| 36 | +- [Umbraco Heartcore](/examples/cms-umbraco-heartcore) |
| 37 | +- [Builder.io](/examples/cms-builder-io) |
| 38 | +- [TinaCMS](/examples/cms-tina/) |
| 39 | +- [Enterspeed](/examples/cms-enterspeed) |
| 40 | + |
| 41 | +## How to use |
| 42 | + |
| 43 | +Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init), [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/), or [pnpm](https://pnpm.io) to bootstrap the example: |
| 44 | + |
| 45 | +```bash |
| 46 | +npx create-next-app --example blog-starter blog-starter-app |
| 47 | +``` |
| 48 | + |
| 49 | +```bash |
| 50 | +yarn create next-app --example blog-starter blog-starter-app |
| 51 | +``` |
| 52 | + |
| 53 | +```bash |
| 54 | +pnpm create next-app --example blog-starter blog-starter-app |
| 55 | +``` |
| 56 | + |
| 57 | +Your blog should be up and running on [http://localhost:3000](http://localhost:3000)! If it doesn't work, post on [GitHub discussions](https://github.com/vercel/next.js/discussions). |
| 58 | + |
| 59 | +Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). |
| 60 | + |
| 61 | +# Notes |
| 62 | + |
| 63 | +`blog-starter` uses [Tailwind CSS](https://tailwindcss.com) [(v3.0)](https://tailwindcss.com/blog/tailwindcss-v3). |
0 commit comments