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 "your_email@example.com"
然后需要配置
git config --global user.email “you@example.com”
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
確認沒問題了再發布


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM