Skip to content

๐Ÿ“• An super fast, lightweight and SEO friendly blog made by Astro ๐Ÿ“•

Notifications You must be signed in to change notification settings

gaomingzhao666/nano-blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

76 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

[![Stargazers][stars-shield]][stars-url] [![MIT License][license-shield]][license-url] [![Release][release-shield]][release-url]

Logo

Nano Blog

๐Ÿ“• An super fast, lightweight and SEO friendly blog made by Astro ๐Ÿ“•

English ยท ็ฎ€ไฝ“ไธญๆ–‡ ยท ๆ—ฅๆœฌ่ชž

Table of Contents

The image shown here is a index-page for laptop-size, click here to see more detailed screenshot for this application.

openblog Lighthouse Score

๐Ÿ’ช Features

  • [โˆš] Minimal styling
  • [โˆš] Mobile responsive
  • [โˆš] 100/100 Lighthouse performance
  • [โˆš] SEO-friendly with canonical URLs and OpenGraph data
  • [โˆš] Sitemap support
  • [โˆš] RSS Feed support
  • [โˆš] Markdown & MDX support
  • [โˆš] Syntax highlighting
  • [โˆš] Image optimization
  • [โˆš] Table of contents
  • [โˆš] Dark mode
  • [โˆš] Reading Time
  • [โˆš] Pagefind static search library integration
  • [โˆš] Related posts
  • [โˆš] Share posts (Linkedin, twitter)
  • [โˆš] Draft mode
  • [โˆš] Copy code block
  • [โˆš] CMS in the repository (Tina CMS)
  • [โˆš] Pagination
  • [โˆš] ViewTransition (new)
  • [โˆš] Disqus comments (new)

๐Ÿ›ฃ๏ธ Roadmap

  • Add post author
  • Add customization with colors
  • Add filters for reading time, date...
  • More sharing options
  • Internationalization (i18n)

โš™๏ธ Stack

๐Ÿ˜Ž Prerequisites

  • NodeJS v20 LTS above

๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป Running Locally

  1. Clone or fork the repository:

  2. Install dependencies:

cd nano-blog
pnpm install
  1. Run the development server:
pnpm start

๐Ÿ“ Configure

  • Edit the configuration file src/data/site.config.ts for the basic blog metadata.
  • Update the astro.config.mjs file at the root of the project with your own domain.
  • Modify the files in the /public folder:
    • favicon
    • robots.txt -> update the Sitemap url to your own domain
    • open-graph -> the open-graph is the image that will be displayed when sharing the blog link. For posts, the preview image is the post cover.
  • Edit the social networks in the Header component - src/components/Header.astro, change the URL to your social network.

๐Ÿ—‚๏ธ 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 <---

๐Ÿฅฐ Thanks to