网站修改记录
Reimu主题改动
字体颜色
文件:themes\hugo-theme-reimu\assets\css\_variables.scss
下
--color-default: #444;
改为
--color-default: #000000;
字体更黑
推荐直接暴露出来,上下两种用一种就行
# 文件:themes\hugo-theme-reimu\assets\css\main.scss下
# 82行添加
$color-default: {{ default "#444" (index $params.internal_theme.light "--color-default") }};
# 文件:themes\hugo-theme-reimu\assets\css\_variables.scss下
# 16行改
--color-default: #444;
# 为
--color-default: #{$color-default};
# 之后改只需要改params.yml文件
internal_theme:
light:
--color-default: '#000000'
代码块
# params.yml文件
# 代码块颜色
internal_theme:
lignt:
--highlight-nav: "#F3F3F3"
--highlight-scrollbar: "#d6d6d6"
--highlight-background: "#F3F3F3"
# 代码块背景取消阴影模糊,感觉这样更简洁直观
# themes\hugo-theme-reimu\assets\css\partials\highlight.scss文件
# 删掉
box-shadow: var(--shadow-card);
# 和
box-shadow: var(--shadow-card-hover);
要将主题颜色修改为 Bilibili (哔哩哔哩) 的标志性粉蓝色调
原
internal_theme:
light:
--red-0: '#ff0000'
--red-1: '#ff5252'
--red-2: '#ff7c7c'
--red-3: '#ffafaf'
--red-4: '#ffd0d0'
--red-5: '#ffecec'
--red-5-5: '#fff3f3'
--red-6: '#fff7f7'
--color-red-6-shadow: 'rgba(255, 78, 78, 0.6)'
--color-red-3-shadow: 'rgba(255, 78, 78, 0.3)'
现
light:
--red-0: '#00aeec' # 深蓝色(用于悬停或强调) #007eb1
--red-1: '#00aeec' # B站标准品牌蓝(主色调)
--red-2: '#40c5f1' # 次级蓝色
--red-3: '#7fdcf6' # 浅蓝色
--red-4: '#bfedfa' # 极浅蓝
--red-5: '#e5f7fd' # 背景淡蓝
--red-5-5: '#f1fbfe' # 极淡背景色
--red-6: '#f8fdff' # 近白色背景
--color-red-6-shadow: 'rgba(0,0,0,0)' # 蓝色阴影(深) 0, 174, 236, 0.6
--color-red-3-shadow: 'rgba(0,0,0,0)' # 蓝色阴影(浅) 0, 174, 236, 0.3
示例
要将主题颜色修改为 Bilibili (哔哩哔哩) 的标志性粉蓝色调,我们需要将原本的红系(Red)变量替换为 B站经典的 “少女粉” 或 “电视蓝”。
在 2025 年的 UI 设计中,B站主要使用 #FB7299 作为主色调。以下是为你调整后的配置,将原有的红色阶替换为了过渡自然的 B站粉色系:
internal_theme:
light:
# Bilibili 风格粉色系(由深到浅)
--red-0: '#E05D84' # 深粉色(用于悬停)
--red-1: '#FB7299' # B站主色(正粉色)
--red-2: '#FF8AAB' # 次级粉
--red-3: '#FFB3C6' # 淡粉
--red-4: '#FFD9E2' # 极淡粉
--red-5: '#FFF1F4' # 浅粉背景
--red-5-5: '#FFF7F9' # 极浅背景
--red-6: '#FFFFFF' # 白色基准
# 投影颜色调整(基于 B站粉)
--color-red-6-shadow: 'rgba(251, 114, 153, 0.6)'
--color-red-3-shadow: 'rgba(251, 114, 153, 0.3)'
# 这里的变量名虽然叫 --red,但实际显示已变为 B站粉
# 如果你想增加 B站蓝(#00AEEC)作为高亮,可以修改下面的部分变量
--highlight-aqua: "#00AEEC" # 将水蓝色改为 B站品牌蓝
--highlight-blue: "#007AAB" # 深蓝色
在 Hugo Reimu 主题中,要将默认的“灵梦红”改为 Bilibili 蓝,你需要调整 internal_theme 下的变量值。
以下是基于 Bilibili 官方品牌蓝(#00AEEC)调配的配色方案,你可以直接替换配置文件中的相应部分:
internal_theme:
light:
--red-0: '#007eb1' # 深蓝色(用于悬停或强调)
--red-1: '#00aeec' # B站标准品牌蓝(主色调)
--red-2: '#40c5f1' # 次级蓝色
--red-3: '#7fdcf6' # 浅蓝色
--red-4: '#bfedfa' # 极浅蓝
--red-5: '#e5f7fd' # 背景淡蓝
--red-5-5: '#f1fbfe' # 极淡背景色
--red-6: '#f8fdff' # 近白色背景
--color-red-6-shadow: 'rgba(0, 174, 236, 0.6)' # 蓝色阴影(深)
--color-red-3-shadow: 'rgba(0, 174, 236, 0.3)' # 蓝色阴影(浅)
--highlight-nav: "#fdfdfd"
在 Hugo 博客框架中,让菜单标签在新页面打开
- name: travel
url: "travel.moe"
icon: f57e
params:
external: true # 某些主题通过此参数识别外部链接并自动新窗口打开
target: "_blank" # 显式指定目标
添加导航栏菜单
menu:
- name: foreverblog
url: "https://foreverblog.cn/go.html"
icon: f197
themes\hugo-theme-reimu\i18n\zh-CN.yml
文件下添加
travelling: 开往
travel: 跃迁
foreverblog: 穿梭
i18n 是 Internationalization(国际化)的缩写
其命名源于首尾字母 “i” 和 “n” 之间共有 18 个字母
字体
# Font loading strategy
# Custom Font -> Google Fonts -> Local FallBack Font
# Custom Font
# v0.9.0 添加了 custom_font 配置用于定义自定义字体,其优先级最高:
custom_font:
enable: false
article:
# - css:
# name:
# - css: https://fontsapi.zeoseven.com/292/main/result.css # font css
# name: LXGW WenKai # font name
code:
# https://fonts.google.com/
# Google Fonts, higher priority than local_font
font:
enable: false
article:
# - Mulish
# - Noto Serif SC
code:
# - Ubuntu Mono
# - Source Code Pro
# - JetBrains Mono
# Local FallBack Font
# v0.2.0 添加了 local_font 配置用于定义本机字体,其优先级比谷歌字体低:
local_font:
article:
- "-apple-system"
- PingFang SC
- Microsoft YaHei
- sans-serif
code:
- Menlo
- Monaco
- Consolas
- monospace
改动
local_font:
code:
- "Cascadia Code"
- "JetBrains Mono" # 现代代码字体
配置建议与说明
- 性能考量:如果你开启了
custom_font或font,浏览器会从服务器下载字体文件,这可能会在初次加载时导致文字有短暂的“闪烁”或延迟显示。 - 代码字体 (
code):强烈建议使用 JetBrains Mono 或 Cascadia Code,它们带有连字特性且非常易读,配合你之前配置的 B 站蓝代码块,效果极佳。 - 避坑指南:如果你在
custom_font中配置了 CSS,请确保链接是 HTTPS 的,否则在 2025 年主流浏览器中会因为“混合内容”安全策略被拦截,导致字体加载失败。
社交链接
# themes\hugo-theme-reimu\assets\css\partials\sidebar.scss
@if index($social-keys, "qq") {
.icon-qq {
color: #00aeec;
}
}
@if index($social-keys, "travel") {
.icon-travel {
color: #e77c8e;
}
}
@if index($social-keys, "travelling") {
.icon-travelling {
color: #000001;
}
}
@if index($social-keys, "foreverblog") {
.icon-foreverblog {
color: #000001;
}
}
@if index($social-keys, "email") {
.icon-email {
color: #00aeec;
}
}
@if index($social-keys, "bilibili") {
.icon-bilibili {
color: #00aeec;
}
}
# themes\hugo-theme-reimu\assets\css\fontawesome.scss
@if index($social-keys, "qq") or $triangle-badge-icon == "qq" {
.icon-qq:before {
content: "\f1d6";
}
}
@if index($social-keys, "travel") or $triangle-badge-icon == "travel" {
.icon-travel:before {
content: "🛸";
}
}
@if index($social-keys, "travelling") or $triangle-badge-icon == "travelling" {
.icon-travelling:before {
content: "🚇";
}
}
@if index($social-keys, "foreverblog") or $triangle-badge-icon == "foreverblog" {
.icon-foreverblog:before {
content: "🛸";
}
}
# themes\hugo-theme-reimu\assets\css\partials\sidebar.scss
# 图标变大
.sidebar-social-icon {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: 40px;
height: 29px;
@if $icon_font {
font: 24px $font-icon;
} @else {
font: 24px var(--font-icon);
}
transition: transform 0.2s;
will-change: transform;
&:hover {
transform: scale(1.4);
}
}
fontawesome
# themes\hugo-theme-reimu\assets\css\fontawesome.scss
.icon-pencil:before {
font-family: var(--font-icon);
content: "\f303";
}
.icon-calendar:before {
font-family: var(--font-icon);
content: "\f133";
font-weight: 900;
}
@if index($social-keys, "travel") or $triangle-badge-icon == "travel" {
.icon-travel:before {
content: "🛸";
}
}
@if index($social-keys, "travelling") or $triangle-badge-icon == "travelling" {
.icon-travelling:before {
content: "🚇";
}
}
@if index($social-keys, "foreverblog") or $triangle-badge-icon == "foreverblog" {
.icon-foreverblog:before {
content: "🛸";
}
}
2024/1/2 你好 hugo
更换 hugo 博客框架,stcak 主题,纯静态就是快。
修改记录很长点击展开
hugo博客 stack主题 修改备份
1 - 添加好物和软件
-
app.html和hardware.html文件放进主题的layouts_default目录下,app.json和hardware.json放进主题data目录下
-
修改主题./assets/scss/custom.scss文件添加样式
/* Place your custom SCSS in HUGO_SITE_FOLDER/assets/scss/custom.scss */ // hardware硬件页样式 .quanju { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); grid-gap: 15px; /* 中间空10px间距 */ } .bankuai { background-color: #ffffff; border-radius: 4px; padding: 20px; transition: all .3s cubic-bezier(0, 0, .5, 1); } .bankuai:hover { box-shadow: 2px 4px 16px rgba(0, 0, 0, .05); } .duiqi { display: flex; justify-content: center; align-items: center; } .duiqi img { width: 80%; margin: 0; transition: transform 0.3s ease; } .bankuai:hover .duiqi img { transform: scale(1.05); } .title { font-family: var(--font-family-title); font-size: 18px; margin: 8px 0 8px 0; } .note { font-size: 16px; line-height: 1.6; color: #666; } .hardware_link, .hardware_index_link { margin-bottom: 15px; margin-top: 10px; display: flex; grid-gap: 8px; flex-wrap: wrap; //宽度显示不下自动换行 } .details { padding: 0 10px; text-align: center; font-size: 14px; border-radius: 20px; font-family: var(--font-family-code); height: 30px; display: flex; justify-content: center; align-items: center; } .tiyi { padding: 0 10px; text-align: center; font-size: 14px; border-radius: 20px; font-family: var(--font-family-code); height: 30px; display: flex; justify-content: center; align-items: center; } .jiage { padding: 0 10px; text-align: center; font-size: 14px; border-radius: 20px; font-family: var(--font-family-code); height: 30px; display: flex; justify-content: center; align-items: center; } .tiyi { color: #be3051; background-color: transparent; border: 0.5px solid #be3051; } .liing_2_right { margin-left: auto; } .details, .jiage { color: #666; background-color: transparent; border: 0.5px solid #dadada; } .bankuai a:hover { text-decoration: none; } .tiyi:empty, .details:empty { display: none; } .pagetitle { margin-left: 80px; margin-right: 80px; } // 页面宽度小于700样式 @media (max-width:700px) { .hardware-index-nrong { height: 400px !important; } .hardware-img { padding-top: 20px !important; } .hardware-img img { width: 200px !important; } } // 页面宽度大于700小于900样式 @media screen and (min-width:700px) and (max-width:900px) { .tuij-index { display: grid; grid-template-columns: 1fr 1fr; /* 两列等宽 */ grid-gap: 10px; /* 中间空10px间距 */ } } // 页面宽度大于900样式 @media (min-width:900px) { .quanju { margin-right: 50px; margin-left: 50px; } .tuij-index { display: grid; grid-template-columns: 1fr 1fr; /* 两列等宽 */ grid-gap: 15px; /* 中间空10px间距 */ } } // 夜间模式页面样式 [data-scheme="dark"] { .bankuai { background: #201d1e; } .title { color: #bbbbbb; } .note { color: #999; } .hardware-index-button { border: 0.5px solid #544d4e !important; color: #666; } .hardware-index { background: #201d1e !important; } .hardware-info { color: #666 !important; } .hardware-1 { background-color: #3c3739 !important; } .hardware-2 { background-color: #5f595b !important; } .hardware-index-nrong { background-color: #2f2b2c !important; } .hardware-note { color: #999 !important; } .details, .jiage { border: 0.5px solid #454545; color: #999; } .hardware_index_link a { color: #999 !important; } } // 软件 app 样式 .appdquanjudiv { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); grid-gap: 15px; /* 中间空10px间距 */ } .appquanju, .app-index { border-radius: 4px; align-items: center; background-color: #ffffff; transition: all .3s cubic-bezier(0, 0, .5, 1); display: grid; grid-template-columns: auto 1fr; /* 第一列宽度自动,第二列平分剩余空间 */ grid-gap: 15px; /* 可选项,设置列之间的间隔 */ } .appquanju { padding: 20px; background-color: #ffffff; } .appquanju:hover { box-shadow: 2px 4px 16px rgba(0, 0, 0, .05); } .appquanju:hover .appimg img { transform: scale(1.04); } .appimg img { width: 90px; border-radius: 22.5%; transition: transform 0.3s ease; } .apptitle { font-size: 18px; font-weight: 600; } .appnote, .appnote-index { font-size: 16px; line-height: 1.6; color: #666; text-align: justify; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; } .appnote { margin-bottom: 15px; -webkit-line-clamp: 3; } .app-title-all { margin-bottom: 8px; } .appzhuangtai-right { margin-left: auto; } .appzhuangtai, .app-title-all { display: flex; gap: 8px; flex-wrap: wrap; //宽度显示不下自动换行 align-items: center; } .appnote-index { margin-bottom: 0; -webkit-line-clamp: 2; } .macos { padding: 0 10px; text-align: center; font-size: 12px; border-radius: 20px; font-family: var(--font-family-code); height: 28px; display: flex; justify-content: center; align-items: center; } .macos { color: #999; background-color: #F2F2F2; } .macos:empty, .kaiyuan:empty, .shoufei:empty, .free:empty { display: none; } .kaiyuan, .shoufei, .free { font-size: 12px; padding: 2px 6px; border-radius: 20px; } .kaiyuan { color: #e59c13; background-color: transparent; box-shadow: inset 0 0 0 0.5px #e59c13; } .shoufei { color: #0774e0; background-color: transparent; box-shadow: inset 0 0 0 0.5px #0774e0; } .free { color: #11a173; background-color: transparent; box-shadow: inset 0 0 0 0.5px #11a173; } .appdquanjudiv a:hover { text-decoration: none; } .apptitle a:hover { text-decoration: underline; } .pagetitle { font-size: 18px; line-height: 1.8; margin-bottom: 20px; } // 夜间模式页面样式 [data-scheme="dark"] { .appquanju { background-color: #201d1e; } .macos { color: #666; background-color: #2E282A; } .appnote, .appnote-index { color: #999; } .app-index { background-color: #2f2b2c; } } -
./content/page目录下新建app.md和hardware.md,内容如下
title: "好物或硬件" layout: "hardware" menu: main: weight: -60 params: icon: 你的图标
更好看的:
2 - 友链改成双栏或三栏
在博客根目录下的assets下创建一个名为scss的文件夹,然后在scss文件夹里创建一个名为custom.scss的文件。
其实在主题的assets\scss\custom.scss文件下写入也可以,看你喜欢。
在custom.scss中写入以下内容:
// ~\blog\assets\scss\custom.scss
//--------------------------------------------------
//链接三栏
@media (min-width: 1024px) {
.article-list--compact.links {
display: grid;
grid-template-columns: 1fr 1fr 1fr; //三个1fr即为三栏,两个1fr则为双栏,以此类推即可.
background: none;
box-shadow: none;
gap: 1rem;
article {
background: var(--card-background);
border: none;
box-shadow: var(--shadow-l2);
margin-bottom: 8px;
border-radius: var(--card-border-radius);
&:nth-child(odd) {
margin-right: 8px;
}
}
}
}
参考:https://github.com/CaiJimmy/hugo-theme-stack/pull/375
3 - 归档页面改成双栏或三栏
跟上一步一样在主题的assets\scss\custom.scss文件下写入
/* 归档页面两栏 */
@media (min-width: 720px) {
.article-list--compact {
display: grid;
grid-template-columns: 1fr 1fr;
background: none;
box-shadow: none;
gap: 1rem;
article {
background: var(--card-background);
border: none;
box-shadow: var(--shadow-l2);
margin-bottom: 8px;
border-radius: 16px;
}
}
}
4 - 修改Toc样式
toc每个标题之间的行间距有点大,于是就缩了缩,在custom.scss文件中又追加了如下的修改:
.widget--toc {
background-color: var(--card-background);
border-radius: var(--card-border-radius);
display: flex;
flex-direction: column;
color: var(--card-text-color-main);
overflow: hidden;
// display:inline-block;
font-size: 16px;
#TableOfContents {
overflow-x: auto;
ol,
ul {
margin: 10;
padding: 0;
}
ol {
list-style-type: none;
counter-reset: item;
li:before {
counter-increment: item;
content: counters(item, ".") ". ";
font-weight: bold;
margin-right: 0px;
}
}
& > ul {
padding: 0 1em;
}
li {
margin: 5px 20px;
padding: 6px;
& > ol,
& > ul {
margin-top: 10px;
padding-left: 6px;
margin-bottom: -5px;
& > li:last-child {
margin-bottom: 0;
}
}
}
}
}
5 - 添加评论功能
5.1 - waline 没搞明白怎么docker部署
docker run -d \
-e LEAN_ID=huochuan-blog \
-e LEAN_KEY=huochuan-blog-key \
-e LEAN_MASTER_KEY=huochuan-blog-master-key \
-p 8360:8360 \
lizheming/waline
# docker-compose.yml
version: '3'
services:
waline:
container_name: waline
image: lizheming/waline:latest
restart: always
ports:
- 127.0.0.1:8360:8360
volumes:
- ${PWD}/waline/data:/app/data
environment:
TZ: 'Asia/Shanghai'
SQLITE_PATH: '/root/waline/sqlite/app/data'
JWT_TOKEN: 'huochuan'
SITE_NAME: 'huochuan'
SITE_URL: '64.176.35.191:8360'
SECURE_DOMAINS: '64.176.35.191:8360'
AUTHOR_EMAIL: 'hechuan4@outlook.com'
docker run -d --name waline -p 8360:8360 \
-v /root/waline/data:/app/data \
-e TZ="Asia/Shanghai" \
-e JWT_TOKEN:'huochuan'\
-e SQLITE_PATH:'/root/sqlite/app/data' \
-e AUTHOR_EMAIL="hechuan4@outlook.com" \
-e SITE_NAME="huochuan" \
-e SITE_URL="64.176.35.191:8360" \
-e SECURE_DOMAINS="hechuan.me" \
--restart always \
lizheming/waline:latest
5.2 - twikoo 很简单就部署好了
docker run --name twikoo -e TWIKOO_THROTTLE=1000 -p 8686:8080 -v ${PWD}/data:/app/data -d imaegoo/twikoo
5.3 - artalk
6 - 访问统计
6.1 - 安装不蒜子
打开 layouts\partials\footer\components 下的 script.html 文件扔进去就好。
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js">
script>
然后 layouts\partials\footer 文件夹下的 footer.html 文件中填写:
<i class="powerby">
<span id="busuanzi_container_site_pv">
访问量 - <span id="busuanzi_value_site_pv">span>
span>
<span id="busuanzi_container_site_uv">
访客数 - <span id="busuanzi_value_site_uv">span>人次
span>
i>
刷新就好了。
6.2 - umami
7 - 说说页面
- https://gameapp.club/post/2022-03-10-talks-for-blog/
- 轻语
- 微语
- https://www.braindance.top/posts/kkapi+ispeak%E8%AF%B4%E8%AF%B4%E9%A1%B5%E9%9D%A2%E9%83%A8%E7%BD%B2/ 这个是iSpeak教程
- https://eallion.com/memos-deployment/#memos-awesome (感觉这个好用 https://github.com/songquanpeng/microblog)
7.1 - memos
docker run -d --name memos -p 5230:5230 \
-v /root/memos:/var/opt/memos \
neosmemo/memos:latest
8 - 头像旋转
在 /assets/scss/custom.scss 中加入以下代码:
// 头像旋转动画
.sidebar header .site-avatar .site-logo {
transition: transform 1.65s ease-in-out; // 旋转时间
}
.sidebar header .site-avatar .site-logo:hover {
transform: rotate(360deg); // 旋转角度为360度
}
参考:https://www.xalaok.top/post/stack-modify/
9 - 代码块样式和颜色
在 /assets/scss/custom.scss 中加入以下代码:
// 代码块基础样式修改
.highlight {
max-width: 102% !important;
background-color: var(--pre-background-color);
padding: var(--card-padding);
position: relative;
border-radius: 12px;
margin-left: -7px !important;
margin-right: -12px;
box-shadow: var(--shadow-l1) !important;
&:hover {
.copyCodeButton {
opacity: 1;
}
}
}
// light模式下的代码块样式调整
// 备份颜色#fff9f3,#fff9f3cc
[data-scheme="light"] .article-content .highlight {
background-color: #F0EFEB;
}
[data-scheme="light"] .chroma {
color: #ff6f00;
background-color: #F0EFEB;
}
10 - 其他一些调整
分享一个配色网站:https://colordrop.io/
// 页面基本配色
:root {
--body-background: #f2f2f2;
--card-background: #DEDEDE;
--pre-background-color: #fafafa;
// 行内代码背景色
--code-background-color: #f8f8f8;
// 行内代码前景色
--code-text-color: #e96900;
// 全局顶部边距
--main-top-padding: 30px;
// 卡片间距
--section-separation: 20px;
}
// 文章内容图片圆角阴影
.article-page .main-article .article-content {
img {
// 文章图片大小
//max-width: 96% !important;
height: auto !important;
border-radius: 7px;
}
}
typecho 迁移到 hugo
**参考:**https://eallion.com/typecho-to-hugo/
适合于像这种链接形式为: https://example.com + slug 的博客进行导出。这样导出的 Markdown 博文,会在 Front matter 里添加 slug 值,以利于后续设置。
脚本地址:
注意: 这并不是一个 Typecho 插件!
用法:
- clone 或 下载 master.zip
- 修改 convert.php 中的 mysql 账号密码(第 3 行)
$db->connect ('localhost','root','password','typecho');
- 将 convert.php 上传到网站目录下
- 通过浏览器访问
htttps://www.example.com/convert.php即可导出 Hugo 所需要的格式了。 - 所有文章会在网站根目录,批量复制到 Hugo 即可。
convert.php 代码如下
<?php
$db= new mysqli();
$db->connect('localhost','root','password','typecho');
$prefix = "typecho";
$sql=<<<TEXT
select u.screenName author,url authorUrl,title,text,created,t2.category,t1.tags,slug from {$prefix}_contents c
left join
(select cid,CONCAT('"',group_concat(m.name SEPARATOR '","'),'"') tags from {$prefix}_metas m,{$prefix}_relationships r where m.mid=r.mid and m.type='tag' group by cid ) t1
on c.cid=t1.cid
left join
(select cid,CONCAT('"',GROUP_CONCAT(m.name SEPARATOR '","'),'"') category from {$prefix}_metas m,{$prefix}_relationships r where m.mid=r.mid and m.type='category' group by cid) t2
on c.cid=t2.cid
left join ( select uid, screenName ,url from {$prefix}_users) as u
on c.authorId = u.uid
TEXT;
$db->query("set character set 'utf8'");//读库
$res=$db->query($sql);
if($res){
if($res->num_rows>0){
while($r=$res->fetch_object()) {
$_c=date('Y-m-d H:i:s',$r->created);
$_t=str_replace('<!--markdown-->','',$r->text);
$_a = str_replace(array('C#'),'CSharp',$r->tags);
$_g = str_replace(array('C#'),'CSharp',$r->category);
$_g = str_replace(array(','),'-',$_g);
$_author = $r->author;
if ($r->authorUrl != "" && $r->authorUrl != "http://www.typecho.org") {
$_author = "<a href=\"{$r->authorUrl}\" rel=\"noopener\" target=\"_blank\">{$r->author}</a>";
}
$_tmp = <<<TMP
---
title: "$r->title"
categories: [$r->category]
tags: [$r->tags]
draft: false
slug: "$r->slug"
date: "$_c"
---
$_t
TMP;
$file_name=$r->title;
file_put_contents(str_replace(array(" ","?","\\","/" ,":" ,"|", "*" ),'-',$file_name).".md",$_tmp);
}
}
$res->free();
}
$db->close();
一个有意思的
网站根目录./archetypes/default.md文件里是hugo默认的文章模板Frontmatter
---
title: "{{ replace .File.ContentBaseName "-" " " | title }}"
slug: "{{ replace .Name "-" " " | title }}"
description:
date: {{ .Date }}
image:
math:
license:
hidden: false
comments: true
---
---的时候用:号,+++的时候用=号才行。
memos
添加评论
参考 @归藏 同学的这篇
友链朋友圈
https://fcircle-doc.yyyzyyyz.cn/#/backenddeploy
https://lms.pub/doit/memos-and-hexo-circle-of-friends.html
最后其他一些可参考的:
一些hugo stack主题的博客可以跳转看看
? 年 你好 typecho
wordpress更新的太臃肿了,换typecho博客框架。
采用 typecho 博客框架,joe 主题,typecho 还是挺简洁的。
修改记录很长点击展开
2.1 - joe 主题
2.1.1 - 文章大纲功能
一、joe 主题增加文章大纲功能
https://github.com/HaoOuBa/Joe/issues/84
文章目录功能是通过 AutocJs 来实现的,具体可以看:https://github.com/yaohaixiao/AutocJS
二、 配置步骤
-
首先进入网站后台,点击更换外观,点击全局设置
-
然后在下方找到 自定义增加
<head></head>里内容(非必填),填入下面代码<style type="text/css"> .outline-outside-modal-opened { z-index: 10000 !important; left: 0; width: 300px !important; } </style> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/yaohaixiao/autocjs/dist/css/autoc.min.css"> -
最后在自定义
<body></body>末尾位置内容(非必填) 中填入下面代码<script src="https://fastly.jsdelivr.net/gh/zhx47/autocjs/dist/autoc.min.js"></script> <script> // 文章导航 if ($(".joe_detail__article").length > 0) { var switcher = document.createElement('div'); switcher.className = 'joe_action_item custom_switcher'; var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); svg.setAttribute('class', 'custom_switcher'); svg.setAttribute("viewBox", "0 0 1024 1024"); svg.setAttribute("xmlns", "http://www.w3.org/2000/svg"); svg.setAttribute("width", "25"); svg.setAttribute("height", "25"); var path1 = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path1.setAttribute('class', 'custom_switcher'); path1.setAttribute("d", "M64.67 512c2.03-148.27 27.78-271.04 103.07-344.26C240.96 92.45 363.73 66.7 512 64.67c148.27 2.03 271.04 27.78 344.26 103.07C931.55 240.96 957.3 363.73 959.33 512c-2.03 148.27-27.78 271.04-103.07 344.26C783.04 931.55 660.27 957.3 512 959.33c-148.27-2.03-271.04-27.78-344.26-103.07C92.45 783.04 66.7 660.27 64.67 512z"); var path2 = document.createElementNS('http://www.w3.org/2000/svg', 'path'); path2.setAttribute('class', 'custom_switcher'); path2.setAttribute("d", "M706.07 405.35H327.44c-18.64 0-33.9-15.25-33.9-33.9 0-18.64 15.25-33.9 33.9-33.9h378.62c18.64 0 33.9 15.25 33.9 33.9 0 18.64-15.25 33.9-33.89 33.9zM706.07 563.37H327.44c-18.64 0-33.9-15.25-33.9-33.9 0-18.64 15.25-33.9 33.9-33.9h378.62c18.64 0 33.9 15.25 33.9 33.9s-15.25 33.9-33.89 33.9zM475.54 721.4h-148.1c-18.64 0-33.9-15.25-33.9-33.9 0-18.64 15.25-33.9 33.9-33.9h148.09c18.64 0 33.9 15.25 33.9 33.9 0.01 18.65-15.25 33.9-33.89 33.9z"); path2.setAttribute("fill", "#FFFFFF"); switcher.appendChild(svg); svg.appendChild(path1); svg.appendChild(path2); document.getElementsByClassName('joe_action')[0].appendChild(switcher); // 创建 Outline 实例 let navigation = new AutocJs({ // 文章正文 DOM 节点的 ID 选择器 article: '.joe_detail__article', // 要收集的标题选择器 selector: 'h1,h2,h3,h4,h5,h6', // 侧边栏导航的标题 title: '文章导读', // 文章导读导航的位置 // outside - 以侧边栏菜单形式显示(默认值) // inside - 在文章正文一开始的地方显示 position: 'outside', // 标题图标链接的 URL 地址 // (默认)没有设置定制,点击链接页面滚动到标题位置 // 设置了链接地址,则不会滚动定位 anchorURL: '', // 链接的显示位置 // front - 在标题最前面(默认值) // back - 在标题后面 anchorAt: 'back', // 是否生成文章导读导航 isGenerateOutline: true, // 是否在文章导读导航中显示段落章节编号 isGenerateOutlineChapterCode: false, // 是否在正文的文章标题中显示段落章节编号 isGenerateHeadingChapterCode: false, // 是否在正文的文章标题中创建锚点 isGenerateHeadingAnchor: false }); } </script>
2.1.2 - 增加侧边栏社交信息
一、添加PC端
打开 Joe/public/aside.php 文件,然后在想要增加的位置添加以下代码
位置:24行到50行
<!-- PC侧栏社交信息 -->
<?php if ($this->options->SocialInfo && (($this->options->SocialSwitch === 'on') || ($this->options->SocialSwitch === 'on2'))) : ?>
<?php
$SocialInfo = $this->options->SocialInfo;
if ($SocialInfo) {
$SocialInfo_arr = explode("\r\n", $SocialInfo);
if (count($SocialInfo_arr) > 0) {
for ($i = 0; $i < count($SocialInfo_arr); $i++) {
$SocialTitle = explode("||", $SocialInfo_arr[$i])[0];
$SocialIco = explode("||", $SocialInfo_arr[$i])[1];
$SocialUrl = explode("||", $SocialInfo_arr[$i])[2];
$SocialInfos[] = array("SocialTitle" => trim($SocialTitle), "SocialIco" => trim($SocialIco), "SocialUrl" => trim($SocialUrl));
}
}
}
?>
<section class="top-social">
<?php foreach ($SocialInfos as $item) : ?>
<li class="<?php echo $item['SocialTitle']; ?>">
<a class="<?php echo $item['SocialTitle']; ?>A" href="<?php echo $item['SocialUrl']; ?>" target="_blank" title="<?php echo $item['SocialTitle']; ?>">
<img src="<?php echo $item['SocialIco']; ?>" />
</a>
</li>
<?php endforeach; ?>
</section>
<?php endif; ?>
二、添加PE端
打开 Joe/public/header.php 文件,然后在想要增加的位置添加上面PC的代码 PE端的代码和上面的一样,只需要将<section class="top-social">换成 <section class="top-social pe-social">
位置:404-429行
<!-- PC侧栏社交信息 -->
<?php if ($this->options->SocialInfo && (($this->options->SocialSwitch === 'on') || ($this->options->SocialSwitch === 'on2'))) : ?>
<?php
$SocialInfo = $this->options->SocialInfo;
if ($SocialInfo) {
$SocialInfo_arr = explode("\r\n", $SocialInfo);
if (count($SocialInfo_arr) > 0) {
for ($i = 0; $i < count($SocialInfo_arr); $i++) {
$SocialTitle = explode("||", $SocialInfo_arr[$i])[0];
$SocialIco = explode("||", $SocialInfo_arr[$i])[1];
$SocialUrl = explode("||", $SocialInfo_arr[$i])[2];
$SocialInfos[] = array("SocialTitle" => trim($SocialTitle), "SocialIco" => trim($SocialIco), "SocialUrl" => trim($SocialUrl));
}
}
}
?>
<section class="top-social pe-social">
<?php foreach ($SocialInfos as $item) : ?>
<li class="<?php echo $item['SocialTitle']; ?>">
<a class="<?php echo $item['SocialTitle']; ?>A" href="<?php echo $item['SocialUrl']; ?>" target="_blank" title="<?php echo $item['SocialTitle']; ?>">
<img src="<?php echo $item['SocialIco']; ?>" />
</a>
</li>
<?php endforeach; ?>
</section>
<?php endif; ?>
三、添加后台
直接在 Joe/functions.php 添加以下代码
位置:53-81行
// 侧栏社交信息开关
$SocialSwitch = new Typecho_Widget_Helper_Form_Element_Select(
'SocialSwitch',
array(
'off' => '关闭(默认)',
'on' => '开启PC社交信息',
'on1' => '开启PE社交信息',
'on2' => '同时开启PC与PE社交信息',
),
'off',
'是否启用侧栏社交信息',
'介绍:开启后,侧栏展示社交信息功能(必须填写下面的侧栏社交信息)'
);
$SocialSwitch->setAttribute('class', 'joe_content joe_other'); //没有custom.php就把joe_custom改成joe_other
$form->addInput($SocialSwitch->multiMode());
//侧栏社交信息
$SocialInfo = new Typecho_Widget_Helper_Form_Element_Textarea(
'SocialInfo',
NULL,
NULL,
'侧栏社交信息',
'介绍:用于设置侧栏社交信息 <br />
格式:社交简称(微信必须固定格式WeChat) || 社交图标 || 跳转链接(微信则填二维码链接) <br />
比如: Bilibili || 图标链接 || id(中间使用两个竖杠分隔) <br />
其他:其他:一行一个,一行代表一个社交信息 '
);
$SocialInfo->setAttribute('class', 'joe_content joe_other'); //没有custom.php就把joe_custom改成joe_other
$form->addInput($SocialInfo);
四、添加样式
在 Joe/assets/css/joe.global.min.css 里添加以下样式
两种选一个就行
.top-social{position:relative;padding:10px 0;width:250px;display:flex;flex-wrap:wrap;background:var(--background);justify-content:space-around;margin-bottom:15px;border-radius:var(--radius-wrap);box-shadow:var(--box-shadow)}.top-social li{width:50px;text-align:center;padding:5px 0px}.top-social li img{height:25px}.top-social .wechat{position:relative}.top-social .wechat .wechatInner{display:none;position:absolute;box-shadow:0px 1px 4px 2px var(--theme);border-radius:var(--radius-wrap);transition:.7s all ease;background:var(--background);-webkit-transition:.7s all ease;top:-175px;left:-45px;transform:translate3d(0, 16px, 0);width:140px;height:140px}.top-social .wechat .wechatInner::before{content:"";position:absolute;bottom:-16px;left:0;right:0;margin:auto;display:inline-block;width:0px;border:18px solid transparent;border-bottom:none;border-top-color:#fff;filter:drop-shadow(0px 4px 2px var(--theme))}.top-social .wechat .wechatInner img{border-radius:var(--radius-wrap);width:140px;height:auto;padding:0;background:none}.top-social .wechat:hover .wechatInner{display:block}.pe-social{width:100%}
用的这个目前
.top-social{position:relative;padding:5px 0;width:250px;display:flex;flex-wrap:wrap;background:var(--background);justify-content:space-around;margin-bottom:15px;border-radius:var(--radius-wrap);box-shadow:var(--box-shadow);li{width:50px;text-align:center;padding:5px 0;position:relative;img{height:32px}.WeChatInner{display:none;position:absolute;box-shadow:0 1px 4px 2px var(--theme);border-radius:var(--radius-wrap);transition:.7s all ease;background:var(--background);-webkit-transition:.7s all ease;top:-175px;left:-50px;transform:translate3d(0,16px,0);width:150px;height:150px;z-index:2;&::before{content:"";position:absolute;bottom:-16px;left:0;right:0;margin:auto;display:inline-block;width:0;border:18px solid transparent;border-bottom:0;border-top-color:var(--background);filter:drop-shadow(0px 4px 2px var(--theme))}img{border-radius:2px;width:140px;height:auto;margin:5px;background:0}}&:hover .WeChatInner{display:block}}}.pe-social{width:100%}
五、添加JS
实际没加这个,也是能用的.
可以直接在 Joe/assets/js/joe.global.min.js 最后添加
修改了第45行
<script src="<?php $this->options->themeUrl('assets/js/custom.min.js'); ?>"></script>
2.1.3 - 取消版权许可
public/copyright.php文件
注释掉
<!--
<div class="item">
<svg class="icon" width="20" height="20" viewBox="0 0 1024 1024">
<path d="M0 512a512 512 0 1 0 1024 0A512 512 0 1 0 0 512z" fill="#F3B243" />
<path d="M540.672 323.584a90.112 90.112 0 1 0 180.224 0 90.112 90.112 0 1 0-180.224 0zM540.672 688.128a90.112 90.112 0 1 0 180.224 0 90.112 90.112 0 1 0-180.224 0zM229.376 512a90.112 90.112 0 1 0 180.224 0 90.112 90.112 0 1 0-180.224 0z" fill="#FFF" />
<path d="M341.037 480.37l257.344-175.718 27.713 40.592-257.34 175.718z" fill="#FFF" />
<path d="M349.053 488.452L601.907 670.56l-28.725 39.887L320.307 528.34z" fill="#FFF" />
</svg>
<span>作品采用:</span>
<span class="text">
《
<a class="link" href="//creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="noopener noreferrer nofollow">署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)</a>
》许可协议授权
</span>
</div>
-->
2.2 - 改用 0A-My 主题
这个主题有点卡。
或者可以看下这个主题:https://github.com/happyet/Gplus
最开始 你好 wordpress
第一个域名:sadahalu。来源于银魂里的神乐的狗的名字(定春),域名太长了。
第二个域名就是这个站。
1.1 - memory 主题
https://shawnzeng.com/ 制作的,开源版:https://github.com/ShawnZeng1996/Memory,不更新了。

说些什么吧!