📘 Blog Handbook

How to publish a new post on raylei.space. You write, the agent handles the chores.

1 The flow at a glance

💡
Plantopic, category, slug
🧱
Scaffoldfile + cover generated
✍️
WriteVS Code, paste screenshots
🖼️
Imagesupload & swap links
🔍
Check & previewrules + localhost
🚀
Publishdeploy + back up source

YOU creative work  ·  AGENT tedious work  ·  TOGETHER agent runs it, you approve

2 Step-by-step checklist

1

Plan the post YOU

Decide three things: the title (Chinese is fine), the category (see §4), and a short English slug for the filename. Optionally add tags and whether it's 日常学习 or 工作学习.

2

Scaffold post + cover AGENT

New post: title "Docker入门笔记", category 编程算法, slug Docker_basics, tags Docker, Linux, 工作学习.

The agent creates source/_posts/45-Docker_basics.md with the right front-matter, the 序言 / 正文 / 最后 skeleton and the [第45篇] footer. It also renders the cover and shows it to you. Ask for a different line break if you like (e.g. "split the cover as Docker | 入门笔记"), then approve and it gets uploaded.

Or run it yourself: npm run blog -- new --title "Docker入门笔记" --category 编程算法 --slug Docker_basics --tags Docker,Linux --kind 工作学习

3

Write YOU + agent on request

Open the file in VS Code and write. Press Ctrl+K V for a live preview on the side. Paste screenshots with Ctrl+V; they show up in the preview straight away.

Ask for help whenever you want. The agent keeps your voice:

Polish the 序言 of #45: fix typos and flow, but keep my wording.
Write the description for #45 from the content.
Turn this list of commands into a table.
4

Upload images AGENT

Upload the images for #45.

Every pasted image is pushed to the Pics repo as post_img/image-<timestamp>.png, and its link in the post is replaced with the CDN URL.

Or run it yourself: npm run blog -- images 45

5

Check & preview TOGETHER

Check #45 and start a preview.
  • npm run blog -- check 45 --online → must say 0 error(s)
  • npx hexo clean; npx hexo s → open http://localhost:4000 and read it once
  • Cover, banner, images and code blocks look right? Description reads well?
6

Publish TOGETHER

Publish #45.

The agent never publishes without this go-ahead. It runs:

npx hexo clean; npx hexo g; npx hexo d        # site → main branch (live in ~1 min)
git add -A; git commit -m "Add post 45"; git push origin hexo   # back up sources

3 Writing in VS Code

Shortcuts you'll use

Ctrl+K VPreview side-by-side
Ctrl+Shift+VPreview in a tab
Ctrl+VPaste screenshot (saved locally, uploaded in step 4)
drag + ShiftDrop an image file into the post
Ctrl+Alt+UPicGo: upload clipboard image immediately (needs token, §6)
Ctrl+Shift+OJump to a heading
Ctrl+Alt+IOpen Copilot chat (talk to the agent)

Two ways to add images

A. Paste now, upload later (default, no token needed)
Ctrl+V → saved to tools/paste/45-…/ → step 4 uploads them all in one go.

B. Upload immediately (PicGo)
Ctrl+Alt+U → uploaded and the CDN link is inserted, just like Typora used to do.

Tip: select some text before pressing Ctrl+Alt+U and PicGo uses it as the image file name.

4 Conventions cheat-sheet

Front-matter (the agent fills this in for you)

---
title: "[编程算法] Docker入门笔记"
date: 2026-12-02 21:30:00
tags: [工作学习, Docker, Linux]
categories: 编程算法
description: "[第45篇] 本章为……的学习笔记。"
top_img: https://cdn.jsdelivr.net/gh/0Rayhlei0/Pics@main/blog_img/algorithm.jpg
cover: https://cdn.jsdelivr.net/gh/0Rayhlei0/Pics@main/cover_img/45-Docker_basics.jpg
---
RuleExample
Filename = number + English slug45-Docker_basics.md
Title starts with the category in brackets[编程算法] …
First tag is 日常学习 or 工作学习[工作学习, Docker]
Description starts with the post number[第45篇] …
Body: 序言/前言 → 正文 → 最后 → references[1]: https://… "标题"
Last line is the post number[第45篇]
New images use @mainold posts keep @latest, don't touch

Categories → banner (top_img) → cover background

Cover style

cover example

The category banner, blurred, with the title in white rounded font (Resource Han Rounded) centred on top. 1500×1000 JPG, about 100 KB.

  • The title is split into 1–3 balanced lines automatically.
  • To choose the breaks yourself, use |: --text "LinuxOS|复习笔记"
  • To redo a cover: npm run blog -- cover 45 --text "…" --upload --force

5 Command reference

Run these in the VS Code terminal (Ctrl+`) from the blog folder. Normally the agent runs them for you.

CommandWhat it does
npm run blog -- nextNext free post number
npm run blog -- new --title … --category … --slug …Create post + cover (--upload to upload the cover too)
npm run blog -- cover 45 [--text "a|b"] [--upload] [--force](Re)generate a cover → tools/out/
npm run blog -- images 45 [--dry-run]Upload pasted images, rewrite links
npm run blog -- upload <file> --dir post_imgUpload any single file to Pics
npm run blog -- check 45 --onlineCheck conventions + that every image loads (all = every post)
npx hexo sLocal preview at localhost:4000
npx hexo clean; npx hexo g; npx hexo dBuild and publish the site

6 Accounts & tokens

🔐 Git sign-in SET UP ✓

Publishing, source backups and image uploads (steps 2, 4 and 6) all use Git Credential Manager. You sign in once in the browser and Windows stores it securely. No token to copy and nothing expires yearly.

If GitHub ever asks again, a sign-in window simply pops up. Choose Sign in with your browser.

Setup: Git 2.56 at F:\Git · images clone at G:\Personal Blogs\Pics

🔑 PicGo token YOU · optional

Needed only for Ctrl+Alt+U instant uploads.

  1. Open github.com/settings/personal-access-tokens/new
  2. Name: PicGo – Pics, Expiration: 1 year
  3. Repository access → Only select repositories → 0Rayhlei0/Pics
  4. Permissions → Repository → Contents: Read and write
  5. Generate, copy the token (github_pat_…)
  6. Open %USERPROFILE%\.picgo\config.json and paste it as the value of "token", then save
Never paste a token into chat or commit it. When it expires, PicGo uploads fail with 401. Repeat these steps (GitHub e-mails you a week before).

7 Troubleshooting

An image shows as broken / returns 403

The link probably uses @latest. That alias only points to the last release of Pics (v1.0.35), so newer files aren't there. Change @latest to @main in that link. check 45 --online catches this.

I replaced an image but the site still shows the old one

jsDelivr caches @main for up to 12 h. Re-upload with --force (the tool purges the cache automatically), or open https://purge.jsdelivr.net/gh/0Rayhlei0/Pics@main/<path> in a browser.

check says "body has local image paths"

You pasted images that haven't been uploaded yet. Run step 4 (npm run blog -- images 45).

Push / deploy fails with "Authentication failed"

Run git push once in the terminal. The browser sign-in window will appear. If it keeps failing, open Windows Credential Manager → Windows Credentials, remove git:https://github.com, then try again.

PicGo (Ctrl+Alt+U) says 401 / Bad credentials

The token expired or was mistyped. Redo §6 "PicGo token". Uploads through npm run blog -- images keep working without it.

The cover text breaks in an ugly place

npm run blog -- cover 45 --text "第一行|第二行". Check tools/out/45-….jpg, then add --upload --force.

Adding a new category

Ask the agent. A banner needs to be added to Pics/blog_img/, plus mappings in _config.butterfly.yml (category_per_img) and tools/blog.js (CATEGORIES).