GDB

About

What is gdb

gdb(github discussion blog), host blog content on GitHub, using GitHub Discussions as CMS for our Markdown content and then eventually using GitHub API to retrieve the content.

GitHub Discussion

Setup

Script

For the fetching part extra build step for Astro, and here’s how it goes:

"scripts": {
  "fetch": "node scripts/fetch-discussions.mjs",
},

Usage

npm run fetch --repository "${{github.repository}}" # for example: npm run fetch --repository "mfuu/gdb"

Config

Change your website config in src/site.config.ts

const config = {
  site: '', // your website url
  base: '', // your website base path
  author: '',
  description: '', // your website description
  title: '', // your website title
  postPageSize: 5, // post per page size
  dir: 'ltr', // "rtl" | "auto"
  lang: 'en', // html lang code. Set this empty and default will be "en"
  timezone: 'Asia/Shanghai', // Default global timezone (IANA format) https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

  navs: [], // navigation links
};

const socials = []; // social links

const shareLinks = []; // post share links

Giscus

By default, giscus is enabled. If necessary, please modify the src/giscus.config.ts configuration yourself.

giscus: {
  enable: true,
  repo: '',
  mapping: 'number',
  emitMetadata: 0,
  inputPosition: 'bottom',
  reactionsEnabled: 1,
  lang: 'zh-CN',
  loading: 'lazy',
  lightTheme: 'light',
  darkTheme: 'dark',
}

Please ensure that your repo has installed the Giscus App.

Generate Blog

Automatic synchronization with GitHub Workflow, detail in .github/workflows/generate-blog.yml.

Others

My blog theme source: AstroPaper. Of course you can freely adjust it to the theme you want.