Chance favors the prepared mind.
FOSSA Status GitHub repo size GitHub tag (latest by date) GitHub commits since tagged version GitHub last commit Better Uptime Badge
✨Live Preview:https://www.eallion.com ✨
https://eallion@bitbucket.org/eallion/eallion.com
https://gitlab.com/eallion/eallion.com
Tip
Remote url 传递 id:token 免输各个 git 仓库的账号密码
git remote set-url --add --push origin https://id:token@github.com/eallion/eallion.com.git $ git remote -v origin https://github.com/eallion/eallion.com (fetch) origin https://github.com/eallion/eallion.com (push) origin https://eallion@bitbucket.org/eallion/eallion.com.git (push) origin https://gitlab.com/eallion/eallion.com.git (push) origin https://git.eallion.com/git/eallion/eallion.com.git (push)
- 国内:部署至阿里云 OSS (Jul 20, 2024)
- 境外:部署至 Cloudflare Pages (Jul 20, 2024)
Update: Jul 20, 2024
🎨 主题 Blowfish
Update:Apr 01, 2024
本博客使用主题为:Blowfish
此次更新,主题使用 git submodule 的方式引入,不破坏原主题任何文件结构,所有自定义样式不再在 Theme 目录下修改。
git submodule add https://github.com/eallion/blowfish.git themes/DoIt
克隆博客后同时克隆 主题 和 mastodon-embed-timeline:
git submodule update --init --recursive
# pnpm run recursive如果上游主题有更新,更新 主题 和 mastodon-embed-timeline:
- git submodule update --remote --merge + pnpm run theme
Blowfish 编译 TailwindCSS 的 main.css ,位于 assets/css/compiled/main.css:
# cd theme/blowfish # pnpm install # cd ../.. # pnpm run dev pnpm run build
https://github.com/eallion/eallion.com/blob/main/assets/css/compiled/main.css
- 自定义 CSS 在
assets/css/如:assets/css/mastodon-timeline-custom.scss:
https://github.com/eallion/eallion.com/blob/main/assets/css/custom.css
- 自定义 JS 在
assets/js/如:pangu.custom.js:
https://github.com/eallion/eallion.com/blob/main/assets/js/pangu.custom.js
- 自定义模板,如嘀咕、豆瓣等页面,在
layouts/_default如:layouts/_default/mastodon.html:
https://github.com/eallion/eallion.com/blob/main/layouts/_default/mastodon.html
- 页面数据在
data如书影音数据:data/neodb/movie.json:
https://github.com/eallion/eallion.com/blob/main/data/neodb/movie.json
pnpm run dev启动 TailwindCSS 监听pnpm run hugo构建 Hugo,一般不用,都是交给 CI/CD 构建pnpm run new创建新文章,直接输入文章标题,生成到 example 目录pnpm run prepareGit Commit Husky 勾子,目前用于提交时更新 Cloudflare Pages Wrangler 的HUGO_VERSIONpnpm run preview启动 Hugo 服务器,即预览线上生成环境,文档内容为content目录pnpm run recursive递归更新 Submodule 子项目,一般第一次克隆本项目时使用pnpm run build构建 Blowfish 的 TailwindCSSassets/css/compiled/main.csspnpm run server启动 Hugo 服务器,文档内容为example目录pnpm run shiki生成 Shiki 语法高亮,目前已取消pnpm run theme更新 Submodule 子项目pnpm run vercel构建适用于 Vercel 平台的 Hugo,在 Vercel 平台使用pnpm run winnat谨慎使用,用于 Windows 重置 Winnat,解决绑定 1313 端口冲突
嘀咕页面 https://www.eallion.com/mastodon 为 Mastodon 个人实例 e5n.cc 的数据展示。
利用 mastodon-embed-timeline 这个项目集成到博客页面。
通过 Git submodule 添加:
git submodule add https://github.com/eallion/mastodon-embed-timeline.git assets/lib/mastodon-embed-timeline
通过 Hugo 命令 New 一篇新文章模板:
现改为 pnpm 命令:
- hugo new posts/daily/new_title.md + pnpm run new # node scripts/new_post.js
如果需要用上 彩云小译 自动翻译标题为 slug,需要 Token。
- 导入 Token
export CAIYUN_TOKEN=3975l6lr5pcbvidl6jl2- 复制 .env.example 为 .env.local
CAIYUN_TOKEN=3975l6lr5pcbvidl6jl2
放在文章目录中,命名为 feature*.png,格式建议为 .png 和 .jpg 。
放在文章目录中,命名为 background*.png,格式建议为 .png 和 .jpg 。
Icon 可以从网上下载,放到 assets/icons 目录下,格式为 .svg,必须添加 fill="currentColor" 属性。可通过 Shortcodes {{< icon "github" >}}引用
通过 Typora 或 VSCode 编辑第一步 pnpm run new 出来的文章。
这篇文章在 example/blog/{title} 目录下,文件名为:{title}/index.md,{title} 为pnpm run new 输入的文字。
编辑好之后需要把这个文件复制到 content/blog 相应的目录中,再 git push。
缩略图(OG:Image)放在文章同目录下,命名为:feature*.png
title(必填) 自动生成,按需修改authors:目录保持默认:["eallion"],其他支持:["shanzei"]categories(必填) 按需修改tags(必填) 按需修改 (约定:本博客单篇文章标签数上限为 4)slug(必填) 按需修改,文章网址 URLsummary(必填) AI 生成摘要series(选填)系列series_weight(选填)系列中的排序seriesNavigation(选填)是否需要显示在系列导航中draft: true(必填) 如果需要公开发表,需改为:draft: false
(削除) 写完文章,按 data 目录中的 summary.json 文件手动生成摘要。 (削除ここまで)
Summary 生成 AI 摘要现在添加到 blog 目录中的 Markdown 文件中的 Front Matter 中,依然采用手动生成的方式。
打开 https://cover.eallion.com (备用) 生成缩略图,此缩略图如果命名为 feature*.png 也可以当成 oEmbed(OG image),放到博客文章同目录下。
注意查看 Layouts 中的模板和 data 中的数据文件。
嘀咕:到 e5n.cc 发 Toot;观影:到 NeoDB 标记;友情链接:数据按data目录中的friends/links.json文件更新;随手拍:到 e5n.cc 发带有#ealbum标签的 Toot;好物:数据按data目录中的goods.json文件更新;Penta:数据按data目录中的penta.json文件更新。
完成写作后,Push 到 GitHub 仓库会自动构建部署。
git add . git commit -m "docs: add a new post" git push
完全没有必要把 Hugo 当成 Web Server
已添加脚本:
- ./server.sh + pnpm run server # 查看博客实际效果 👇 # pnpm run preview # git submodule update --remote --merge && \ # start http://192.168.0.5:1313 && \ # hugo server \ # -w \ # -D \ # -p 1313 \ # --bind 0.0.0.0 \ # --contentDir example \ # --minify \ # --forceSyncStatic \ # --ignoreCache \ # --noHTTPCache \ # --disableFastRender \ # -e production \ # --enableGitInfo \ # --disableKinds RSS \ # --printUnusedTemplates \ # --templateMetrics \ # --templateMetricsHints
运行脚本后会自动打开预览页面:http://127.0.0.1:1313
hugo server把 Hugo 当作 Web 服务器,而非构建静态网页-w有文件变化立即刷新 (默认开启)-D构建草稿,撰写新文章时很有用-p 1313指定端口号 1313 (默认 1313)-t hello-friend使用 hello-friend 主题-enableGitInfo开启 GitIifo--bind 0.0.0.0绑定 IP,局域网其他设备 Debug 时很有用--contentDir example指定文章目录example,默认为content--cleanDestinationDir清空目标目录--forceSyncStatic强制同步静态文件--ignoreCache忽略缓存--noHTTPCache关闭 HTTP 缓存--renderStaticToDiskHugo 0.97.0 新特性,从硬盘渲染静态文件,从内存渲染动态文件--disableFastRenderDoIt 主题使用了.Scratch,建议开启此参数-e productionDoIt 的评论系统、CDN和fingerprint不会在 development 环境下启用hugo server --help查看 server 所有命令
手动构建命令:
- hugo --cleanDestinationDir --forceSyncStatic --gc --ignoreCache --minify --enableGitInfo + pnpm run hugo
--cleanDestinationDir构建前先清理目标目录,即 public--forceSyncStatic强制同步 static 目录--gc构建后执行一些清理任务 (删除掉一些没用的缓存文件)--ignoreCache构建时忽略缓存--minify压缩网页代码--enableGitInfo开启 GitIifohugo --help查看所有命令
因为 jsDelivr Aug 15,2020 的 ‘新政策’,现在没有用 GitHub + jsDelivr 当图床了。
- 方法一
手动添加图床。
现在写博客添加图片,需要手动添加图片地址。
一般本博客会使用腾讯云 COS,图床链接为:https://images.eallion.com/
- 方法二
直接把图片丢到 Hugo 仓库的 static/assets/images 或者 assets/images 目录下即可。
对于存放在 static/assets/images 目录下 (可按年月分类) 的图片有 2 种方法引用图片 URL:
/assets/images/1970/01/01.jpg https://www.eallion.com/assets/images/1970/01/01.jpg
对于存放在 assets/images 目录下的图片一般用 resources.Get :
{{ with resources.Get "images/a.jpg" }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}- 文章图片
Blowfish 新增
对于文章图片,现在放于文章文件 index.md 同级目录
现在的相册页面采用 e5n.cc 的 #ealbum 标签动态渲染,只是一个示例页面。
数据按 data/penta/penta.json 格式维护即可,五杀截图放到 static/assets/images/penta/screenshot 目录。
英雄头像腾讯官方 API https://lol.qq.com/cguide/Guide/PublicResources/Images.html
This project is licensed under GLWTPL
Hugo is licensed under Apache License 2.0
Theme Blowfish is licensed under MIT
GLWT(Good Luck With That,祝你好运)公共许可证
版权所有© 每个人,除了作者
任何人都被允许复制、分发、修改、合并、销售、出版、再授权或
任何其它操作,但风险自负。
作者对这个项目中的代码一无所知。
代码处于可用或不可用状态,没有第三种情况。
祝你好运公共许可证
复制、分发和修改的条款和条件
0 :在不导致作者被指责或承担责任的情况下,你可以做任何你想
要做的事情。
无论是在合同行为、侵权行为或其它因使用本软件产生的情形,作
者不对任何索赔、损害承担责任。
祖宗保佑。