6

将 Hexo 升级到 V7.0

 8 months ago
source link: https://blog.devtang.com/2024/01/07/upgrade-hexo-to-v7-0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

这次重装 M2 的电脑,Hexo 在设置的时候报很多警报,一些依赖库因为太旧有安全风险,查了一下 Hexo 有最新发布的 7.0 版本,于是打算整体迁移一下。

安装 Hexo 7.0

首先 Hexo 的安装可以用 brew 了。使用 brew install hexo安装,安装好之后 Hexo 在 /opt/homebrew/Cellar/hexo/7.0.0 下。

使用 Hexo 的如下指令完成建站

hexo init blog
cd blog
npm install

建完站之后,把之前的文章都复制进去,在 themes 目录下同样把 Archer clone 下来:

git clone https://github.com/fi3ework/hexo-theme-archer archer

然后需要在 blog 根目录下安装以下插件:

npm install hexo-deployer-git --save
npm install hexo-generator-json-content
npm install hexo-generator-feed --save
npm install hexo-wordcount

除此之外还需要一些配置,修改 _config.yml,增加如下内容:

jsonContent:
meta: true
pages: false
posts:
title: true
date: true
path: true
text: false
raw: false
content: false
slug: false
updated: false
comments: false
link: false
permalink: true
excerpt: false
categories: true
tags: true

并且将 _config.yml 的主题为 Archer:

theme: archer

最后,复制 Archer 主题目录下的 _config.yml 到 Hexo 根目录,并命名为 _config.archer.yml。删除 Archer 主题目录下的 _config.yml 文件,或将它重命名为 _config.yml.template,避免配置合并或冲突。

这次 Archer 也更新了很多,所以看起来升级是必要的。详见:https://github.com/fi3ework/hexo-theme-archer

因为我在 config.yml 中配置好了deploy信息:

# Deployment
deploy:
type: git
message: "Site updated: {{ now('YYYY-MM-DD HH:mm') }}"
repo:
github: [email protected]:tangqiaoboy/tangqiaoboy.github.com.git
branch: master

日常操作主要是以下几个:

#发布新文章
hexo new 文件名

#预览
hexo s

#生成文件到 public 目录
hexo g

#发布到 Github Pages
hexo d

需要注意,如果改了文件发布的话,要先 hexo g,然后再 hexo d


Recommend

  • 39
    • www.v2ex.com 6 years ago
    • Cache

    或许是 Hexo 上最强大的主题

    分享创造 - @SukkaW - ![]( https://i.loli.net/2018/07/27/5b5b2eee0dc9b.png)# Suka ThemeModern · Powerful · Simple<

  • 11
    • geekvic.top 3 years ago
    • Cache

    Hexo 进阶设置

    部署平台选型GitHub 和 Gitee(码云)是国内外比较流行的代码托管平台,现都推出 GitHub/Gitee Pages 可以存放静态网页代码,因此可以用来搭建自己的博客。 平台 优点 缺点 Github 全球最流行的平台,且免费 国内由于有墙,访问太慢 Gitee...

  • 13
    • geekvic.top 3 years ago
    • Cache

    Hexo 如何快速搭建个人博客

    什么是 Hexo?Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。 Node.js 所带来的超快生成速度,让上百个页面在几秒内瞬间完成渲染。 Hexo 支...

  • 11
    • liujiacai.net 3 years ago
    • Cache

    博客系统迁移:Hexo 到 Hugo

    上一篇文章介绍了 Emacs 的理念以及其强大的扩展功能,基本上能在 Emacs 里面做到事,我都在 Emacs 里面做。之前的博客一直都是用的 markdown 来书写,虽然 Emacs 也有 markdown 插件,但是总感觉体验不如 org-mode。这周末就趁着手热,把博客系统进行了升级,...

  • 14

    I do not know why exactly I am so stubborn to insist on making this site multilingual, and in a way that you may see multiple languages at the same time. But it is something. 我自己也不明白为什么我执拗得一定要把这网站做成多语言的,还是叫人 能...

  • 3
    • yanhaijing.com 3 years ago
    • Cache

    我的hexo笔记

    我的hexo笔记 原创 编辑 ...

  • 5
    • anran758.github.io 3 years ago
    • Cache

    Hexo blog 的升级与同步方案

    Hexo blog 的升级与同步方案 发表于 2019-11-02 更新于 2020-11-01 分类于 Hexo 阅读次数: 242 Disqus:

  • 2
    • www.iyouhun.com 2 years ago
    • Cache

    Hexo博客升级随笔

    Hexo博客升级随笔 - 游魂博客-分享技术,资源共享 首页 / Hexo博客升级随笔 最近 hexo 博客升级,把遇到的问题做个备份。 由于长时间没同步该博客文章,J...

  • 9

    Hexo Maupassant 主题升级重装记录0 CommentMaupassant 好像一直在更新,这次重装,算是跟上了节奏。(本篇算是写给自己的备忘) node 降级遇...

  • 9
    • claude-ray.com 2 years ago
    • Cache

    Hexo NexT 主题升级 7.4

    Hexo NexT 主题升级 7.4 Posted on 2019-09-12...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK