如何搭建Hexo博客,并发布到github上

1、安装好git

2、安装好npm、node

3、切换npm的源,现在阿里的cnpm不行了,要切换成新的:

复制代码
npm config set registry https://registry.npmmirror.com
npm config get registry

4、安装hexo-cli

复制代码
npm install -g hexo-cli

查看是否安装成功: 
hexo -v

5、博客初始化:创建一个文件夹,进入该文件夹

复制代码
 hexo init
在博客文件夹的根目录右键打开 GitBash
hexo s
在浏览器输入localhost:4000查看

新建文章

hexo new "标题"

切换主题

去hexo模板市场 更换,然后放进来themes文件夹,修改_config.yml里面的themes配置即可

发布到github上

1、npm install --save hexo-deployer-git

2、在github创建仓库,名为:xxx.github.io xxx是你的github名字

3、修改_config.yml

复制代码
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://你的github名.github.io/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
  trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
  trailing_html: true # Set to false to remove trailing '.html' from permalinks

...

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
deploy:
  type: git
  repository: https://github.com/你的github名/你的github名.github.io.git
  branch: master

修改代码后推送到github

hexo d

相关推荐
用户9751470751363 分钟前
双向绑定VUE,单向绑定react区别
github
虎头金猫31 分钟前
小米摄像头本地化存储教程:Go2RTC+EasyNVR 搭建私有监控系统
langchain·开源·github·aigc·智能家居·开源软件·ai编程
用户9751470751361 小时前
在 Vite 中配置 CSS 模块时,如何处理不同 CSS 模块之间的冲突?
github
汪海游龙1 小时前
03.24 AI 精选:2小时从零训练26M参数GPT的教学项目
github
苦瓜小生1 小时前
AI-TestHub:我如何从零开发一个智能测试用例生成平台
人工智能·python·测试工具·github·测试用例·fastapi
记忆张量MemTensor2 小时前
AI 数据迁移指南|Claude 靠提示词搬家,MindDock 一键完整备份记忆
人工智能·python·开源·github·浏览器
MIXLLRED2 小时前
创建 GitHub 私人仓库并上传本地项目的完整步骤
ubuntu·github
小龙报2 小时前
【Coze-AI智能体平台】解锁 Coze 工作流:逻辑控制・数据处理・AIGC 多媒体全场景实战
人工智能·深度学习·机器学习·语言模型·自然语言处理·github·aigc
掘金安东尼2 小时前
企业级Claw落地避坑指南:70%项目失败的真实原因
前端·面试·github
Moment2 小时前
TypeScript 要换芯了,6.0 竟是旧编译器的最后一舞
前端·javascript·github