Termux搭建hexo博客并部署到GitHub
阅读原文时间:2022年01月17日阅读:1

Termux搭建hexo博客并部署到GitHub

termux-change-repo
apt update
apt install git && nodejs && vim
apt update
npm install hexo -g
mkdir hexo
hexo init hexo
cd hexo
hexo server

安装sah

apt install openssh

生成ssh key

ssh-keygen -t rsa -C "你注册Github用的邮箱"

然后回车

ssh-keygen -t rsa -C "你的邮箱"
# Creates a new ssh key using the provided email
Generating public/private rsa key pair.
Enter file in which to save the key (/your_home_path/.ssh/id_rsa):

再回车

Enter passphrase (empty for no passphrase): [你的密码]

Enter same passphrase again: [你的密码]
你输入的内容是不会显示的

输密码

确认密码

然后查看key的内容

 vim ~/.ssh/id_rsa.pub

把内容全部复制下来,打开https://github.com/settings/keys

点new

title随便填

key就填你ssh key里的内容

然后

npm install hexo-deployer-git --save

然后

vim _config.yml

在里面找到并修改

deploy:
  type: git
  repo: git仓库项目地址
  branch: 分支

还有

url: https://用户名.github.io/
root: /

点ESC输:wq退出来

然后

git config --global user.name "GitHub用户名"
git config --global user.email "GitHub注册邮箱"

然后

hexo clean
hexo g
hexo d

输个ssh key密码就可以了上传到Github了

毕竟原主题实在丑

cd themes
git clone https://gitee/fak3adm1n/fexo.git
cd fexo
vim _config.yml

根据注释自己自定义一下就行

# Blog info
blog_name: Forsigner
slogan: Find the bug of the world
url: http://www.forsigner.com

# Set avatar (Absolute url and relative url)
avatar: /images/avatar.jpg

# Set favicon
favicon: /favicon.ico

# For seo
keywords: forsigner,前端,设计,Hexo主题,前端开发,用户体验,设计,frontend,design,nodejs,JavaScript

home_nav:
  - name: Blog
    url: /archives
    target_blank: false #不在新页面打开
  - name: Project
    url: /project/
    target_blank: true #在新页面打开
  - name: Github
    url: https://github.com/forsigner
    target_blank: true
  - name: Twitter
    url: https://twitter.com/forsigner
    target_blank: true

# config page nav
page_nav:
  - name: 博客
    url: /archives/
    target_blank: false # 不在新页面打开
  - name: 分类
    url: /category/
    target_blank: false
  - name: 标签
    url: /tag/
    target_blank: false
  - name: 友链
    url: /link/
    target_blank: false
  - name: 关于
    url: /about/
    target_blank: false
  - name: RSS
    url: /atom.xml
    target_blank: true # 在新页面打开
  - name: 搜索
    url: /search/
    target_blank: false # 在新页面打开

page_nav_style: CIRCLE  # CIRCLE|ROUND_RECT

# 面包屑
breadcrumb:
  isShow: true # true|fase

# 盒子
toolbox:
  isShow: true # true|fase
  text: 盒子

search_slogan:
  isShow: true # true|fase
  text: Can you find the bug of world ~

link_slogan:
  isShow: true # true|fase
  text: 交换友链可以邮件 forsigner@gmail.com

# set backtop show or hide
backtop:
  home: false
  archive: false
  category: true
  tag: true
  post: true
  link: false
  about: false

donation:
  show: true
  btn_text: 支持一下
  tip: 扫一扫,支持forsigner
  items:
    - type: 微信
      text: 微信扫一扫
      imgUrl: /images/qr-wechat.png
    - type: 支付宝
      text: 支付宝扫一扫
      imgUrl: /images/qr-alipay.png

post:
  header_align: CENTER # LEFT|CENTER
  showToc: true # true|false
  showComments: true
  open_in_new_window: false
  show_prev_next: true

# =========================================================
# 个性化设置
# =========================================================

# Custom CSS style, 推荐把样式文件放在blog源码文件夹,而不是主题里面
personal_style: /css/personal-style.css

# 这个值取决于你得背景图片是深色还是浅色,深色用dark,浅色用light
home_background_scheme: light # dark、light

# custom font-family 暂时只支持这3种英文字体,你可以完全自定义字体(看文档)
blog_name_font_familiy: calligraffittiregular
# blog_name_font_familiy: Lobster-Regular
# blog_name_font_familiy: PoiretOne-Regular

init_page_content: HOME_NAV  # HOME_NAV | POST

# =========================================================
# 第三方服务
# =========================================================
# Stats
google_analytics: UA-38189205-1
baidu_analytics: 57e94d016e201fba3603a8a2b0263af0

# Comment service

# disqus_shortname: forsigner
# hypercomments_id: 89821
# gentie_key: d16a7241e7cd4b389584ed8db2a4e8bc

#有言用户编号
# uyan_key:

# 畅言, doc: http://changyan.kuaizhan.com/
changyan:
  enable: false  # true | false  这里开启
  changyan_appid:
  changyan_appkey:

# gitalk评论组件,把下面的配置换成你的,官方文档: https://gitalk.github.io/
gitalk:
  enable: true # 如果使用 gitalk,请设置改之为true
  clientID: 277317290454635afa73
  clientSecret: 78223c859304da5e8d71bfce136d436c6ff95c37
  repo: blog-comment
  owner: forsigner
  admin: forsigner

# gitment comment service
gitment:
  enable: false  # true | false  这里开启
  owner:  # Your GitHub ID. Required.
  repo:  # The repository to store your comments. Make sure you're repo's owner. Required.
  oauth: # An object contains your client ID and client secret. Required.
    client_id: # GitHub client ID. Required.
    client_secret: # GitHub client secret. Required.
  id: # An optional string to identify your page. Default location.href.
  title: # An optional title for your page, used as issue's title. Default document.title.
  link: # An optional link for your page, used in issue's body. Default location.href.
  desc: # An optional description for your page, used in issue's body. Default ''.
  labels: # An optional array of labels your want to add when creating the issue. Default [].
  theme: # An optional Gitment theme object. Default gitment.defaultTheme.
  perPage: # An optional number to which comments will be paginated. Default 20.
  maxCommentHeight: # An optional number to limit comments' max height, over which comments will be folded. Default 250.

# Valine comment system  https://valine.js.org
valine:
  enable: false # 如果使用valine,请设置改之为true
  appid:  # your leancloud application appid
  appkey:  # your leancloud application appkey
  notify: false # mail notifier , https://github.com/xCss/Valine/wiki
  verify: false # Verification code
  placeholder: Just go go # comment box placeholder
  avatar: mm # gravatar style
  guest_info: nick,mail,link # custom comment header
  pageSize: 10 # pagination size

# 不算子,文章访问量统计和显示
busuanzi: true

# =========================================================
# 页面内容设置
# =========================================================
about:
  - type: me
    icon: icon-user
    text_value:
    - "Scut,1991,Spring."
    - "喜欢设计,擅长编程,喜欢睡懒觉."
    - "前端开发工程师,常用 HTML / CSS / JavaScript."
  - type: Github
    icon: icon-github
    text_key: Github
    text_value: "@forsigner"
    text_value_url: https://github.com/forsigner
  - type: weibo
    icon: icon-weibo
    text_key: 微博
    text_value: "@forsigner"
    text_value_url: http://weibo.com/u/1847075964
  - type: mail
    icon: icon-mail
    text_key: Gmail
    text_value: "forsigner@gmail.com"
  - type: location
    icon: icon-location
    text_value: 珠海

link:
  - name: 织网
    info: 身体和灵魂,总有一个在路上
    url: http://zheng-ji.info/
    avatar: https://avatars3.githubusercontent.com/u/1414745?v=3&s=100
  - name: Dongyado
    info: 生命不止,折腾不息
    url: http://dongyado.com/
    avatar: https://avatars0.githubusercontent.com/u/6274940?v=3&s=100
  - name: OrangeCoder
    info: android ffmpeg nodejs gradle
    url: http://orangecoder.com/
    avatar: https://avatars0.githubusercontent.com/u/2263785?v=3&s=100
  - name: EverET
    info: 好记性不如烂笔头
    url: http://everet.org/about-me/
    avatar: https://avatars1.githubusercontent.com/u/1559563?v=3&s=100
  - name: 题叶
    info: FP, GUI, Writing
    url: http://tiye.me/
    avatar: https://avatars2.githubusercontent.com/u/449224?v=3&s=100
  - name: McChen
    info: Stay Hungry, Stay Foolish
    url: https://chenjiahao.xyz
    avatar: https://avatars0.githubusercontent.com/u/8033333?v=3&s=100

project:
  - type: personal
    name: fexo
    url: https://github.com/forsigner/fexo
    intro: A minimalist design theme for hexo
  # - type: company
  #   name: Fexo
  #   url: https://github.com/forsigner/fexo
  #   intro: A minimalist design theme for hexo
  - type: personal
    name: beside
    url: https://github.com/forsigner/beside
    intro: I need you beside me
  - type: personal
    name: web-fontmin
    url: https://github.com/forsigner/web-fontmin
    intro: 字体子集化,在线提取你需要的字体
  - type: personal
    name: magic-check
    url: https://github.com/forsigner/magic-check
    intro: Beautify Radio and Checkbox with pure CSS
  - type: personal
    name: nice-bar
    url: https://github.com/forsigner/nice-bar
    intro: A nice and lightweight scrollbar
  - type: personal
    name: angular-nice-bar
    url: https://github.com/forsigner/angular-nice-bar
    intro: A nice and lightweight scrollbar in Angular
  - type: personal
    name: fo-popover
    url: https://github.com/forsigner/fo-popover
    intro: A nice popover for Angular
  - type: personal
    name: fo-tooltip
    url: A nice tooltip for Angular
    intro: https://github.com/forsigner/fo-tooltip
  - type: personal
    name: fo-modal
    url: https://github.com/forsigner/fo-modal
    intro: A nice modal for Angular
  - type: personal
    name: mocer
    url: https://github.com/forsigner/mocer
    intro: Setup a mock server easily
  - type: personal
    name: node-pngdefry
    url: https://github.com/forsigner/node-pngdefry
    intro: Repairing iPhone fried PNGs using Node.js
  - type: personal
    name: ng-simditor
    url: https://github.com/forsigner/ng-simditor
    intro: Angular directive for simditor

新建文章是hexo new post 文章标题

hexo clean
hexo g
hexo d