保姆级教学 基于Hexo搭建个人网站(Github)

文章目录

  • 搭建Hexo静态博客
    • 介绍
    • 一、注册Github账号
    • 二、 安装前置软件包
    • 三、 绑定github仓库
      • 创建SSH私钥
      • 添加私钥
      • 连接Github仓库
    • 四、安装hexo
      • 1. 更改npm镜像源
      • 2. 创建一个文件夹 在里面打开终端
      • 3. 初始化hexo
    • 五、切换主题
      • 1. 安装主题
      • 2. 修改默认主题
      • 查看修改主题后的网站
    • 六、主题美化
      • 1. 修改主题标签
      • 2. menu 主页菜单导航
        • 查看修改后效果
    • 七、Hexo常用命令
      • 1. 创建新页面
      • 2. 创建博文
    • 八、推送hexo到github.io上
      • 1. 修改本地博客配置文件
      • 2. 下载插件
      • 推送到互联网

搭建Hexo静态博客

介绍

老久没更新了 做这一篇博客的初衷也是想曝光我的网站 下面是地址 欢迎大家赏脸访问(可能比较卡)
访问我的网站
https://waitayaka.github.io在这里插入图片描述

  • 然后网站里面也有很多这里没有的文章 大家也可以去看一看
    在这里插入图片描述

一、注册Github账号

视频教程点击我

二、 安装前置软件包

  • Git https://git-scm.com/download/win
  • VSCode https://code.visualstudio.com/
  • Typora
  • Node.JS https://nodejs.org/en

三、 绑定github仓库

创建SSH私钥

  • 打开Git Bash输入
git config --global user.name "你的Github用户名"
git config --global user.email "你的邮箱"
  • 创建SSH私钥
$ ssh-keygen -t rsa -C "2187988995@qq.com"  ## 输入自己的邮箱
Generating public/private rsa key pair. //以下选项都回车 什么都不用输入
Enter file in which to save the key (/c/Users/21879/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/21879/.ssh/id_rsa
Your public key has been saved in /c/Users/21879/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:i++Oohyq3eWhzqArA4Z0WuEVD2qUwBz8+gB40JG6zPA 2187988995@qq.com
The key's randomart image is:
+---[RSA 3072]----+
|++++.o.          |
|.++o..o          |
|.oooo  .         |
|=.o=             |
|B+=     S        |
|+BE    . .       |
|o =   + .        |
|o= *.+ +         |
|Bo+o=.oo+        |
+----[SHA256]-----+

  • 查看保存ssh密钥的文件夹 一般都在C:\Users\你的用户\.ssh

image-20240413205804175

添加私钥

image-20240413210113979

image-20240413210146799

image-20240413210214754

image-20240413210328380

image-20240413210355789

连接Github仓库

  1. 在.ssh文件夹下创建config文件

image-20240413210918370

  1. 在config文件中添加以下内容
Host github.com
HostName ssh.github.com  # 这是最重要的部分
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
  1. 测试连接ssh库
$ ssh git@github.com


The authenticity of host '[ssh.github.com]:443 ([20.205.243.160]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ssh.github.com]:443' (ED25519) to the list of known hosts.
PTY allocation request failed on channel 0
Hi WaitAyaka! You've successfully authenticated, but GitHub does not provide shell access.
Connection to ssh.github.com closed.  //显示 HI `你的用户名`!即为连接成功

四、安装hexo

1. 更改npm镜像源

`进入cmd`
 npm config set registry https://registry.npmmirror.com

2. 创建一个文件夹 在里面打开终端

  • 使用npm安装hexo
npm install -g hexo-cli

3. 初始化hexo

hexo init
`初始化完成 后显示`
INFO  Cloning hexo-starter https://github.com/hexojs/hexo-starter.git
INFO  Install dependencies
INFO  Start blogging with Hexo!
  1. 运行博客
hexo g //生成更改内容
hexo s //运行本地网页服务
D:\My Blogs>hexo s
INFO  Validating config
INFO  Start processing
INFO  Hexo is running at http://localhost:4000/ . Press Ctrl+C to stop.

image-20240413211954126

可以使用自己喜欢的主题 可以在网上自行搜索

这里使用particleX 因为很好看

  • 主题官方文档

https://github.com/theme-particlex/hexo-theme-particlex

五、切换主题

1. 安装主题

cd themes
git clone git@github.com:theme-particlex/hexo-theme-particlex.git particlex --depth=1

2. 修改默认主题

  1. 在根目录 _config.yml 设置主题为 ParticleX 即可

image-20240413213142806

image-20240413213316569

查看修改主题后的网站

hexo s

image-20240413213454708

六、主题美化

1. 修改主题标签

还是_config.yaml文件 任意修改以下参数 修改完后记得ctrl+s保存配置

image-20240413213640466

重新启动hexo服务

hexo s

image-20240413213822491

2. menu 主页菜单导航

需要我们进入到主题的_config.yaml进行配置

  • 进入之后找到menu选项
  • image-20240413214121726

我们可以更改Home About这些的定义 比如将Home 换成主页 About 换成关于

image-20240413214221853

查看修改后效果

image-20240413214255331

menu:
    主页:
        name: house
        theme: solid
        link: /
# 关于页面链接:
    关于:
        name: id-card
        theme: solid
        link: /about
# 存档页面链接
    存档:
        name: box-archive
        theme: solid
        link: /archives
# 分类页面链接
    分类:
        name: bookmark
        theme: solid
        link: /categories
# 标签页面链接
    标签:
        name: tags
        theme: solid
        link: /tags

七、Hexo常用命令

hexo clean //清除hexo缓存
hexo g     //重新生成hexo
hexo s     //运行本地服务器
hexo d     //将hexo推送到设置好的服务器上
hexo new   xxx //新建博文
hexo new page xxx //新建页面

博文新建好会存到/<博客根目录>/souce/_post中

采用MarkDown语法

1. 创建新页面

D:\My Blogs\themes>hexo new page "about"
INFO  Validating config
INFO  Created: D:\My Blogs\source\about\index.md
  • 进入Created: D:\My Blogs\source\about\index.md

image-20240413220004608

  • 访问关于页面

image-20240413220026152

2. 创建博文

D:\My Blogs\themes>hexo new "你好Hexo"
INFO  Validating config
INFO  Created: D:\My Blogs\source\_posts\你好Hexo.md

进入 D:\My Blogs\source\_posts\你好Hexo.md

image-20240413220251011

image-20240413220441365

image-20240413220453302

八、推送hexo到github.io上

1. 修改本地博客配置文件

在本地博客中找到_config.yaml找到deploy部分

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

repo: 后面接上你的github仓库地址

2. 下载插件

npm install hexo-deployer-git --save
  • 在命令行中输入
hexo clean //清除缓存
hexo g //生成更改
hexo d //推送到服务器

image-20240413221300325

  • 上传的过程
D:\My Blogs\themes>hexo d
INFO  Validating config
INFO  Deploying: git
INFO  Setting up Git deployment...
Initialized empty Git repository in D:/My Blogs/.deploy_git/.git/
[master (root-commit) 7798c74] First commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 placeholder
INFO  Clearing .deploy_git folder...
INFO  Copying files from public folder...
INFO  Copying files from extend dirs...
warning: in the working copy of '2024/04/13/hello-world/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of '2024/04/13/浣犲ソHexo/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'about/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'archives/2024/04/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'archives/2024/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'archives/index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'css/main.css', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'index.html', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/crypto.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/highlight.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/home.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/math.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/preview.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/lib/search.js', LF will be replaced by CRLF the next time Git touches it
warning: in the working copy of 'js/main.js', LF will be replaced by CRLF the next time Git touches it
[master fd9219c] Site updated: 2024-04-13 22:12:36
 19 files changed, 2778 insertions(+)
 create mode 100644 2024/04/13/hello-world/index.html
 create mode 100644 "2024/04/13/\344\275\240\345\245\275Hexo/index.html"
 create mode 100644 about/index.html
 create mode 100644 archives/2024/04/index.html
 create mode 100644 archives/2024/index.html
 create mode 100644 archives/index.html
 create mode 100644 css/main.css
 create mode 100644 images/avatar.jpg
 create mode 100644 images/background.jpg
 create mode 100644 images/loading.gif
 create mode 100644 index.html
 create mode 100644 js/lib/crypto.js
 create mode 100644 js/lib/highlight.js
 create mode 100644 js/lib/home.js
 create mode 100644 js/lib/math.js
 create mode 100644 js/lib/preview.js
 create mode 100644 js/lib/search.js
 create mode 100644 js/main.js
 delete mode 100644 placeholder
info: please complete authentication in your browser...
Enumerating objects: 34, done.
Counting objects: 100% (34/34), done.
Delta compression using up to 16 threads
Compressing objects: 100% (25/25), done.
Writing objects: 100% (34/34), 1.81 MiB | 906.00 KiB/s, done.
Total 34 (delta 4), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (4/4), done.
To https://github.com/WaitAyaka/Ayaka.github.io.git
 * [new branch]      HEAD -> main
branch 'master' set up to track 'https://github.com/WaitAyaka/Ayaka.github.io.git/main'.
INFO  Deploy done: git

推送到互联网

image-20240413221629306

  • 选择main 并保存

image-20240413221731876

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/598024.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

杭州恒生面试,社招,3年经验

你好&#xff0c;我是田哥 一位朋友节前去恒生面试&#xff0c;其实面试问题大部分都是八股文&#xff0c;但由于自己平时工作比较忙&#xff0c;完全没有时间没有精力去看八股文&#xff0c;导致面试结果不太理想&#xff0c;HR说节后通知面试结果&#xff08;估计是凉了&…

vue2编写主体页面

目录 一. 导入两张图片 二. 新建主体vue 三. 修改路由 1. 新增主体界面Main.vue的路由 2. 完整router/index.js代码如下: 在Vue 2中编写一个主体页面通常意味着创建一个包含导航栏、侧边栏、内容区域等的布局。以下是使用Vue 2和Element UI框架来构建一个简单的主体页面的…

uniapp/微信小程序实现加入购物车点击添加飞到购物车动画

1、预期效果 2、实现思路 每次点击添加按钮时&#xff0c;往该按钮上方添加一个悬浮元素&#xff0c;通过位移动画将元素移到目标位置。 1. 为每个点击元素设置不同的class&#xff0c;才能通过uni.createSelectorQuery来获取每个元素的节点信息&#xff1b; 2. 添加一个与…

Springai入门

一、概述 1.1发展历史 1.2大模型 大模型&#xff0c;是指具有大规模参数和复杂计算结构的机器学习模型。这些模型通常由深度神经网络构建而成&#xff0c;拥有数十亿甚至数千亿个参数。其设计目的在于提高模型的表达能力和预测性能&#xff0c;以应对更加复杂的任务和数据&…

AWS宣布推出Amazon Q :针对商业数据和软件开发的生成性AI助手

亚马逊网络服务&#xff08;AWS&#xff09;近日宣布推出了一项名为“Amazon Q”的新服务&#xff0c;旨在帮助企业利用生成性人工智能&#xff08;AI&#xff09;技术&#xff0c;优化工作流程和提升业务效率。这一创新平台的推出&#xff0c;标志着企业工作方式的又一次重大变…

JetBrains DataSpell v2024.1 激活版 (数据科学家开发环境)

JetBrains系列软件安装目录 一、JetBrains IntelliJ IDEA v2024.1 安装教程 (Java集成开发IDE) 二、JetBrains WebStorm v2024.1 激活版 (JavaScript集成开发IDE) 三、JetBrains PhpStorm v2024.1 安装教程 (PHP集成开发IDE) 四、JetBrains PyCharm Pro v2024.1 安装教程 (…

burp靶场sql注入通关—下

第十一关&#xff08;布尔盲注&#xff09;&#xff1a; 1.根据提示修改包含 TrackingId cookie的请求&#xff0c;先抓包并修改这个值&#xff0c;在后面加上永真式发现出现Welcome back TrackingIdxxxx and 11 再修改这个值为永假式看看&#xff0c;发现没有Welcome back&am…

第二证券|A股,突现两大重磅!

大摩又看上新标的&#xff01; 就在刚才&#xff0c;五粮液和泸州老窖传来重磅音讯&#xff1a;摩根士丹利将泸州老窖目标价从194元上调至206元&#xff0c;将五粮液目标价从180元上调至182元。按这个目标价核算&#xff0c;五粮液还有20%的空间。而摩根士丹利最近似有一种魔力…

【触摸案例-手势解锁案例-按钮高亮 Objective-C语言】

一、我们来说这个self.btns,这个问题啊,为什么不用_btns, 1.我们说,在懒加载里边儿,经常是写下划线啊,_btns,为什么不写,首先啊,这个layoutSubviews:我们第一次,肯定会去执行这个layoutSubviews: 然后呢,去懒加载这个数组, 然后呢,接下来啊,走这一句话, 第一次…

rust容器、迭代器

一&#xff0c;std容器 1&#xff0c;Vec&#xff08;向量、栈&#xff09; use std::vec::Vec; &#xff08;1&#xff09;用作vector let nums:Vec<i32>vec![1,2,4,3];assert_eq!(nums.len(),4);assert_eq!(nums[3],3);assert_eq!(nums.is_empty(),false); 遍历&…

山西·长治大广赛赛题详解

大广赛新命题又又又又来啦&#xff0c;它就是山西长治&#xff0c;让我们一起来看看命题详情吧~ 2024年第16届全国大学生广告艺术大赛山西长治命题素材和资料下载&#xff1a; 命题素材下载https://js.design/f/ZRLbti?sourcecsdn&planbttss507 广告主题&#xff1a; 一…

美易官方:美股周一收高,道指连续第四个交易日上涨

收盘之际&#xff0c;美股市场周一的表现可圈可点&#xff0c;各大股指纷纷走高&#xff0c;道指更是连续第四个交易日实现上涨。这一积极态势不仅凸显了投资者对于全球经济的信心&#xff0c;也反映了市场对于未来前景的乐观预期。 道指涨176.59点&#xff0c;涨幅为0.46%&…

探索5个独特AI工具:它们是否值得独立存在?

在这个“地下AI”系列的最新一集中&#xff0c;我们深入挖掘了一些鲜为人知的AI工具。这些工具并非出自OpenAI、微软或谷歌等科技巨头之手&#xff0c;而是独立创造者和小型团队的智慧结晶。我们的目标是发现利用最新AI技术的独特工具。但这次有个新玩法&#xff1a;我们玩一个…

使用 OpenNJet 分分钟完成打地鼠小游戏部署

文章目录 OpenNJet应用引擎什么是应用引擎什么是OpenNJet独特优势技术架构 OpenNJet安装RPM安装 部署打地鼠小游戏配置OpenNJet部署打地鼠小游戏启动 NJet访问打地鼠小游戏 总结 今天阿Q打算使用OpenNJet应用引擎来部署一下我们的打地鼠小游戏。在开始部署之前&#xff0c;我们…

FME学习之旅---day26

我们付出一些成本&#xff0c;时间的或者其他&#xff0c;最终总能收获一些什么。 【由于上周&#xff0c;上班状态不是很好&#xff0c;事情多又杂&#xff0c;没有学习的劲头&#xff0c;就短暂的休息了一下下。双休爬山&#xff0c;给自己上了强度&#xff0c;今天才缓过来…

PMP培训一般要多久?

考过PMP很久了&#xff0c;学习时长还是记得很清楚的。因为有一部分的项目经验&#xff0c;报了威班PMP的培训&#xff0c;看了宣传是50天通过PMP&#xff0c;但是我仅仅用了一个月出头就搞定了&#xff0c;算下来才四十天不到就已经学完在准备冲刺参加考试了&#xff0c;最后5…

气膜冰球馆助力冰雪运动高速发展—轻空间

冰上运动一直备受人们热爱&#xff0c;其中冰球更是广受欢迎。近年来&#xff0c;随着技术的飞速发展&#xff0c;气膜冰球馆成为了冰上运动领域的新宠。本文将探讨气膜冰球馆在冰上运动中的重要性&#xff0c;以及其未来发展的前景。 气膜冰球馆具有明显的优势。相比传统冰球馆…

C#标签设计打印软件开发

1、新建自定义C#控件项目Custom using System; using System.Collections.Generic; using System.Text;namespace CustomControls {public class CommonSettings{/// <summary>/// 把像素换算成毫米/// </summary>/// <param name="Pixel">多少像素…

社交媒体数据恢复:华为畅连

尊敬的用户您好&#xff0c;以下是关于社交软件华为畅连的聊天记录数据恢复教程。在华为手机中&#xff0c;我们可以通过华为云服务和第三方软件来恢复删除的聊天记录。以下是详细的步骤&#xff1a; 第一步&#xff1a;登录华为云服务 请在您的华为手机上找到并打开“云服务”…

Learning C# Programming with Unity 3D

作者&#xff1a;Alex Okita 源码地址&#xff1a;GitHub - badkangaroo/UnityProjects: A repo for all of the projects found in the book. 全书 686 页。
最新文章