hexo 安装和部署

因为投递论文需要个人网站,所以今天又来了一次hexo 安装和部署。
参考官方文档:https://hexo.io/zh-cn/docs/

git是需要的哈。自行安装

node需要大于8.10

node --version 看一下版本
升级node到13
curl -sL https://deb.nodesource.com/setup_13.x | sudo -E bash -
sudo apt-get install -y nodejs
这个需要等一会儿
npm install -g hexo-cli
这个需要等一会儿
npm install  --save hexo-deployer-git
安装这个,才可以用【hexo d】通过git发布网站

hexo init <folder>
 cd <folder>
 npm install

配置1 生成key,可以git部署网站

ssh-keygen -t rsa -b 4096 -C "[email protected]"
然后需要配置
git config --global user.email “[email protected]”
git config --global user.name “Your Name”
将这个文件拷贝到git的https://github.com/settings/keys

配置2 网站基础配置 _config.yml

# Site
title: 网站标题
subtitle: 子标题
description: 
keywords: 关键词
author: 作者(有可能会显示在网站底端)
language: zh-Hans
timezone:

发布的网站的地址,git的账户需要和这里的网站的名称一致
url: https://xuehuiping.github.io/

网站主题
theme: next  需要提前clone到本地的themes目录

发布相关
deploy:
  type: git
  repo: https://github.com/xuehuiping/xuehuiping.github.io.git
  beanch: master

配置3 网站主题配置

文件:/Users/huihui/my_blog/themes/next/_config.yml

copyright:
  # -------------------------------------------------------------
  # Hexo link (Powered by Hexo).
  powered: false

  theme:
    # Theme & scheme info link (Theme - NexT.scheme).
    enable: false
    # Version info of NexT after scheme info (vX.X.X).
    version: false

menu:
我在这里删除删除了竖线及后面的内容,因为有些报错。
  home: /
  # tags: /tags/
  # categories: /categories/
  archives: /archives/
  #schedule: /schedule/ || calendar
  #sitemap: /sitemap.xml || sitemap
  #commonweal: /404/ || heartbeat
  # about: /about/ || user

配置4 编译和发布

hexo new [文章标题]
hexo clean 清空生成文件
hexo g 生成网站文件
hexo s 本地预览
hexo d 发布到github,可能需要用户名和密码

可以包装成一个命令:hexo clean  & hexo g & hexo s。默认端口4000
确认没问题了再发布

猜你喜欢

转载自www.cnblogs.com/xuehuiping/p/12184596.html