blog-template

Author: penboxlab on January 15, 2025

BlogDarkTailwindSEORSSSearch
blog-template
blog-templateblog-templateblog-templateblog-templateblog-template
Free
GPL3
Screenshot

⭐ Leave a star if you like this project! ⭐️

Deploy with Vercel Deploy to Netlify

πŸ“Œ Table Of Contents

  1. Demo
  2. CMS
  3. Features
  4. Roadmap
  5. Stack
  6. Running locally
  7. Configure
  8. Categories
  9. Posts
  10. Draft
  11. FrontMatter
  12. CLI
  13. Contributors

πŸ’» Demo

Check out the Demo, hosted on Vercel


https://github.com/danielcgilibert/blog-template/assets/44746462/56b8399e-cc5b-45a8-b9d2-d69833ecadb1

πŸ¦™ Tina CMS

By default, this template comes pre-configured with Tina CMS.

Now you can create your posts directly from the CMS without the need to do it manually.

If you decide to use Tina, it’s not necessary to add any properties to the Markdown files, Tina does it automatically.

Example:

https://github.com/danielcgilibert/blog-template/assets/44746462/51ae324c-d383-40be-9b16-db159d1af15d

The documentation for Tina CMS can be found here

Tina is completely optional, and you can remove it, and it will still function in the same way.

πŸ’ͺ Features:

openblog Lighthouse Score

πŸ›£οΈ Roadmap

βš™οΈ Stack

πŸ‘¨πŸ»β€πŸ’» Running Locally

Recommended extensions for VSCode:

  1. Clone or fork the repository:
[email protected]:danielcgilibert/blog-template.git
  1. Install dependencies:
pnpm install
  1. Run the development server:
pnpm dev

πŸ“ Configure

πŸ—‚οΈ Adding a category

To add a new category to your blog, simply go to the src/data/categories.ts file and add it to the array.

Example:

export  const  CATEGORIES  =  [
'JavaScript',
'React',
'new category here'  <---
]  as  const

🚨 Zod checks whether the category is not correctly written or does not exist in the properties of the markdown document. It will throw an error when building the application. 🚨

πŸ“„ Adding a post

Adding a post is as simple as adding a .md or .mdx file to the blog folder at the path src/content/blog. The filename will be used to create the slug/URL of the page.

For example, if you have a file named jsx-and-react.md, it will be transformed into: http://yourdomain.com/post/jsx-and-react/

πŸ“ Activating draft mode

To activate draft mode, add the property draft: true to the file, and it will no longer be displayed on the blog.

Example :

title: MacBook Pro 2022
description: 'The new MacBook Pro 2022 is here. With the Apple M2 chip, a new design, and more, the new MacBook Pro is the best laptop Apple has ever made.'
pubDate: 'Jul 02 2022'
heroImage: '../../assets/bg.jpg'
category: 'Category 1'
tags: ['JavaScript', 'css', 'HTML5', 'GitHub']
draft: true <---

⚑️ Frontmatter

Required properties:

Optional properties:

The schema for posts is located at src/content/config.ts. You can modify any parameter, for example, by adding a maximum of 80 characters for titles: title: z.string().max(80). For more information, refer to the zod documentation.

🧞 Commands

All commands are run from the root of the project, from a terminal:

CommandAction
pnpm installInstalls dependencies
pnpm run devStarts local dev server at localhost:3000
pnpm run buildBuild your production site to ./dist/
pnpm run previewPreview your build locally, before deploying
pnpm run format:checkCheck code format with Prettier
pnpm run formatFormat codes with Prettier
pnpm run syncGenerates TypeScript types for all Astro modules. Learn more.
pnpm run lintLint with ESLint

πŸ‘‹ Contributors