Hexo入坑指南

Hexo入坑指南

JiangWen Master

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

快速开始111

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment

使用主题

Hexo-theme-Redefine reimagines simplicity, speed, and purity, without sacrificing functionality or design. Its sleek, modern aesthetic is packed with useful features, blending style and practicality seamlessly.
Building on the solid foundation of hexo-theme-keep, “Redefine” elevates the style and incorporates valuable writing tools and plugins. It offers extensive customization options, allowing you to tailor every detail to your preferences. With Redefine, your blogging experience becomes unique and effortless, showcasing your personal style and needs.

🌐 Demo

If you are also using Redefine, please go to Redefine Theme Showcase to add your blog link.

⛰️ Features

☁️ Installation

The easiest way to install Theme Redefine is by using npm (after your hexo version has been up to 5.0+)

1
2
$ cd your-hexo-site
$ npm install hexo-theme-redefine@latest

Another method is by git clone

1
2
$ cd your-hexo-site
$ git clone https://github.com/EvanNotFound/hexo-theme-redefine.git themes/redefine

After the installation, go to the _config.yml of your hexo site and set

1
theme: redefine

⏫ Update

To update hexo-theme-redefine, you can run the same npm command

1
$ npm install hexo-theme-redefine@latest

If you installed the theme by git clone, you can update the theme by running the following command

1
2
$ cd themes/redefine
$ git pull

📄 Documentations

Please read Redefine Docs when installing

It’s very easy to understand.

☕ Support

Feel free to pull request and send issues.

If you have any questions, please send an email to contact@ohevan.com. I will reply in time.

Please give me a star to support me, thanks!

Also, if you are using Typora, check out Typora Theme Redefine so that you can preview the styles of your blog in Typora.

💗 Donations

Thanks to all the people who have donated to me. Your support is my greatest motivation.

If you like this theme, please give a star. You can also support me by donating.

This is the list of all the people who have donated to me: Donation List

如果你想要使用OpenAI GPT-4,但不想每月支付 20 美元吗,来看看我的 GPT Plus Share GPT Plus 共享站,使用多达 100 个 ChatGPT Plus 账户,每月仅 17 人民币起步!

GPT Billboard

🌟 Star History

Star History Chart

💻 Development

If you want to contribute to this project, you can clone the dev branch and check out the Development Docs to get started.

进阶优化

新增文章时自动打开Markdown编辑器

需求:由于每次在使用 hexo n "文章名称" 时还要去打开编辑器,这太麻烦了!我们可以通过一个监听的js代码去监听hexo新建文章的命令,并自动打开相应的 Markdown编辑器来实现联动,这样岂不是即方便且优雅!

  1. 首先在 hexo/scripts 下新建一个 editArticle.js 文件,如果没有 scripts 文件可以手动创建一个。

  2. editArticle.js 文件并写入如下内容即可

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
const { spawn } = require("child_process");
const os = require("os");

// 新建文档时,启动typora打开文章
hexo.on("new", (data) => {
const filename = data.path;
const typoraPath = getTyporaPath();

if (typoraPath) {
spawn(typoraPath, [filename]);
}
});

// 根据当前的操作系统,设置启动应用的路径(编辑器可执行文件的位置,要根据自己实际情况更改)
function getTyporaPath() {
const platform = os.type();
if (platform === "Darwin") {
// MacOS
return "/Applications/Typora.app/Contents/MacOS/Typora";
} else if (platform === "Windows_NT") {
// Windows
return "D:\\Typora\\Typora.exe";
} else {
console.error("Unsupported platform:", platform);
return null;
}
}

  • 标题: Hexo入坑指南
  • 作者: JiangWen
  • 创建于 : 2022-09-28 11:45:00
  • 更新于 : 2024-11-24 17:45:51
  • 链接: https://blog.jiangwen.site/2022/09/28/开发学习/Hexo入坑指南/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论