如何搭建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

相关推荐
七牛开发者8 小时前
RAG 工程里的上下文剪枝:如何减少 68% 的上下文
前端·css·github
Alex66302813 小时前
我重写了 Hermes Agent,专门修掉了它的 4 个硬伤
github
考虑考虑13 小时前
git中的tag
git·gitlab·github
小墨同学boy14 小时前
WorkBuddy零基础教程进阶篇
人工智能·github·aigc
BerrySen17815 小时前
GitHub开源项目破圈方法论:从技术自嗨到生态共赢
开源·github
JavaGuide1 天前
一个神级 PR Review Agent 诞生了:读 diff、写总结、找风险全自动!
github·ai编程
逛逛GitHub1 天前
1.3 万人点赞的 GitHub 项目,让 AI Agent 操作 Office 文件。
github
OpenTiny社区1 天前
Skill 设计:封装、评测、运营,一次讲透
前端·github
本地化文档1 天前
xlwings-docs-l10n
python·github·excel·gitcode·sphinx