先从最基本的开始
初始化 Hexo 项目
1 2 3 4
| mkdir hexo(建立一个叫hexo的文件) cd hexo(进入这个文件夹下) hexo init(初始化) npm install
|
启动本地服务器浏览器查看效果
然后安装主题
安装好之后在_config.yml 修改theme:(主题名称)
添加仓库:
deploy:
type: git
repo: https://github.com/aimy1/book.github.io.git
安装一键部署的工具
1
| npm install hexo-deployer-git --save
|
运行三合一
1
| hexo cl & hexo g *& hexo s
|
推送的命令(从新修改本地的推到github,最简单就这一条)
post.md模版,仅供参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| --- title: {{ title }} date: {{ date }} updated: tags: categories: keywords: description: top: top_img: comments: cover: https://img.090227.xyz/file/ae62475a131f3734a201c.png toc: toc_number: toc_style_simple: copyright: copyright_author: copyright_author_href: copyright_url: copyright_info: mathjax: katex: aplayer: highlight_shrink: aside: swiper_index: 10 top_group_index: 10 ai: background: "#fff" ---
<div class="video-container"> [up主专用,视频内嵌代码贴在这] </div>
<style> .video-container { position: relative; width: 100%; padding-top: 56.25%; /* 16:9 aspect ratio (height/width = 9/16 * 100%) */ }
.video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>
|
page.md模版,仅供参考
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| --- title: {{ title }} date: {{ date }} type: updated: comments: description: keywords: top_img: https://img.090227.xyz/file/ae62475a131f3734a201c.png mathjax: katex: aside: aplayer: highlight_shrink: top_single_background: ---
|
新建博文命令
开启本地搜索
1
| npm install hexo-generator-search --save
|
设置主题配置文件
1 2 3 4
| local_search: enable: true preload: false CDN:
|