博客
关于我
win10搭建hexo博客并部署到github
阅读量:239 次
发布时间:2019-03-01

本文共 929 字,大约阅读时间需要 3 分钟。

Hexo博客创建与部署指南

1. 安装Node.js和npm

Hexo博客的核心是基于Node.js,因此首先需要安装Node.js。安装完成后,npm会被默认安装,用于管理依赖项。

2. 安装Hexo

使用npm安装Hexo CLI:

npm install -g hexo-cli

遇到网络问题可使用国内镜像源安装cnpm:

npm install -g cnpm --registry=https://registry.npm.taobao.org

然后用cnpm安装Hexo:

cnpm install -g hexo-cli

验证安装:

hexo -v

3. 创建博客文件夹

新建一个文件夹,进入该文件夹并初始化Hexo:

hexo init

初始化后,目录结构应为:

.├── public/├── source/├── node_modules/...

4. 启动本地服务器

启动Hexo服务:

hexo server

访问http://localhost:4000查看博客首页。

5. 创建和编辑博客

使用hexo new创建新文章:

hexo new "My New Post"

默认生成Markdown文件于source/_posts,可用vim或其他编辑器编辑。

6. 生成静态文件

清除缓存:

hexo clean

生成静态文件:

hexo g

7. 部署到GitHub

创建GitHub仓库,仓库名为username.github.io。编辑_config.yml,设置仓库地址。

安装Hexo Deployer插件:

cnpm install hexo-deployer-git --save

部署:

hexo d

完成后,访问https://username.github.io查看博客。

8. 自定义和优化

推荐使用星星多的主题,例如Next主题。通过修改_config.yml设置主题和其他样式。

注意事项

  • 网速问题可使用cnpm解决。
  • 重启Hexo文件夹并删除后可解决多数问题。
  • 部署前确保仓库名正确,访问地址为username.github.io

通过以上步骤,轻松创建并部署Hexo个人博客,开始你的技术写作之旅吧!

转载地址:http://dwyv.baihongyu.com/

你可能感兴趣的文章
SpringBoot中集成screw(螺丝钉)实现数据库表结构文档生成
查看>>
PROFINET 模拟器使用教程
查看>>
Program type already present: android.support.v4.widget.EdgeEffectCompat
查看>>
PyTorch中文版官方教程来啦(附下载)
查看>>
Progress Kemp LoadMaster 远程命令执行漏洞复现(CVE-2024-1212)
查看>>
Project configuration is not up-to-date with pom.xml. Run Maven->Update Project
查看>>
Project Euler 15 Lattice paths
查看>>
Project Euler 48 Self powers( 大数求余 )
查看>>
Project Euler Problem 12: Highly divisible triangular number
查看>>
ProjectEuler 2
查看>>
projection介绍及EPSG:4326和EPSG:3857的投射转换
查看>>
project打开文件时,显示无法识别此文件格式?
查看>>
Prometheus + Grafana on Kubernetes部署
查看>>
prometheus + grafana进行服务器资源监控
查看>>
Prometheus Alertmanager 告警配置详解
查看>>
Prometheus Grafana 展示平台
查看>>
Prometheus pushgateway使用详解
查看>>
Prometheus 云原生 - Prometheus 数据模型、Metrics 指标类型、Exporter 相关
查看>>
Prometheus 云原生 - 基于 file_sd、http_sd 实现 Service Discovery
查看>>
Prometheus 云原生 - 微服务监控报警系统 (Promethus、Grafana、Node_Exporter)部署、简单使用
查看>>