style: 配置站点副标题/Logo/头像并整理图片资源

- 启用首页副标题(打字机效果)
- 修复 nav.logo 被 theme_config 空值覆盖导致不显示的问题
- 头像改为 /images/core.jpg
- 重做 logo:去白底并圆形内部填白
- 新增 Markdown 使用指南,整理文章图片到对应目录
This commit is contained in:
2026-07-08 23:07:24 +08:00
parent e7de4af00b
commit 61bff7beac
63 changed files with 346 additions and 175 deletions
+6 -4
View File
@@ -1,4 +1,4 @@
// 下载 Markdown 中的掘金外链图片到 source/images/,并替换链接为站内路径
// 下载 Markdown 中的掘金外链图片,按文章归类到 source/images/<文章名>/,并替换链接为站内路径
const fs = require('fs');
const path = require('path');
const https = require('https');
@@ -6,7 +6,9 @@ const http = require('http');
const ROOT = 'c:/Users/Administrator/Desktop/新建文件夹/blog';
const MD = path.join(ROOT, 'source/_posts/Git使用教学.md');
const OUT = path.join(ROOT, 'source/images');
// 以文章文件名(去掉扩展名)作为图片子文件夹名,便于按文章管理
const POST = path.basename(MD, path.extname(MD));
const OUT = path.join(ROOT, 'source/images', POST);
function download(url) {
return new Promise((resolve, reject) => {
@@ -35,7 +37,7 @@ function download(url) {
let content = fs.readFileSync(MD, 'utf8');
const re = /!\[[^\]]*\]\((https:\/\/p3-juejin\.byteimg\.com\/[^)\s]+)\)/g;
const map = {}; // url -> /images/xxx.webp
const map = {}; // url -> /images/<POST>/xxx.webp
let m;
const tasks = [];
@@ -49,7 +51,7 @@ function download(url) {
continue;
}
const file = hash + '.webp';
map[url] = '/images/' + file;
map[url] = '/images/' + POST + '/' + file;
tasks.push(
download(url)
.then((buf) => {