Ubuntu-bk搭建

原文连接

https://ddl08.github.io/2024/10/18/Ubuntu-blog-buid/

node.js

  1. 更新系统索引包↓
    sudo apt update
    安装↓
    sudo apt install nodejs npm
    验证↓
    node -v
    npm -v

git

  1. 检查是否安装↓
    git --version
    ​
    安装↓
    sudo apt update
    sudo apt install git

安装Hexo

  1. # 安装 Hexo
    sudo npm install -g hexo-cli
    ​
    # 创建新项目
    mkdir my-blog
    cd my-blog
    hexo init
    npm install
    ​
    # 启动服务  //起步启动都行
    hexo server   

开github仓

  1. 打开网站https://github.com/new,直接新建,**(**下方的Add a README file记得勾上)
  2. GitHub Pages有两种类型:

    1. 在bk上使用User Pages

    2. 命名DDL08.github.io

    User Pages 是用来展示用户的,而 Project Pages 是用来展示项目的
    用于存放User Pages的仓库必须使用username.github.io 的命名规则,而 Project Pages则没有特殊的要求
    User Pages通过https://username.github.io进行访问,而Projects Pages通过https://username.github.io/projectname进行访                        
    原文链接:https://blog.youkuaiyun.com/qq_52475653/article/details/134723360

ssh连接

配置

git config --global user.name "Github用户名"
git config --global user.email "Github邮箱"
​
进入
​

接下来进入Hexo的项目根目录的_config.yml里面修改deploy(部署)

deploy:
  type: git
  repo: 
    github: git@github.com:DDL08/DDL08.github.io.git,main
​
标注:username替换为自己的用户名,(2020年10月后github新建仓库默认分支改为main)DDL08是我自己的账户,请更换为你的

生成密匙

在没有配置git环境之前,~/.ssh是不存在的↓
cd ~/.ssh
​
ssh-keygen -t rsa -C "Github邮箱"
生成的
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
都按空格就行
​
最后生成Your identification has been saved in /c/Users/Kevin-TP/.ssh/id_rsa.
Your public key has been saved in /c/Users/Kevin-TP/.ssh/id_rsa.pub.

然后去使用

把本地公钥添加到github中;在GitHub中,点击右侧图像下拉选项,选择“Settings”,在“SSH and GPG keys”中,点击“New SSH key”,并将~/.ssh/id_rsa.pub文件里的内容复制上去,保存退出;

测试连接是否成功

ssh -T git@github.com
​
弹出Hi Mshrimp! You've successfully authenticated, but GitHub does not provide shell access.

部署

部署之前要先安装个插件↓
npm install hexo-deployer-git --save
​
部署↓
hexo clean && hexo generate && hexo deploy
等个5分钟本地推送完成+GitHub反应
​
访问https://ddl08.github.io/ 就是部署成功后的结果了

换主题

我用的particleX

预览

新建文章,在里面修改↓
hexo new a
​
预览
hexo s
如果预览无法关闭
ps aux | grep hexo
kill 413521
删除
直接rm就行,在resource的_posts里面直接删除
​
https://www.hesiy-cnpwn.xyz

下载

https://hexo.io/themes/
复制https
根目录git clone https://111 themes/主题名
​

切换主题

#theme: landscape   //注释掉原来的
theme: ParticleX    //写入新的
		butterfly

内容(往下有点乱了,不整理了)

写js
themes/ParticleX/layout/layout.ejs里面进行修改
其他
<!-- more -->
这个标签放到文章里面之后,不点进去只会显示前半部分。
https://argvchs.github.io/2022/04/17/hexo-blog-3/
​
文章缩略
Front-matter is a block of YAML or JSON at the beginning of the file that is used to configure settings for your writings. Front-matter is terminated by three dashes when written in YAML or three semicolons when written in JSON.
​
Front-matter 是文件开头的一段 YAML 或 JSON 代码,用于配置您的写作设置。如果使用 YAML 编写,Front-matter 以三个破折号结束;如果使用 JSON 编写,Front-matter 以三个分号结束。
​
​
缩略方法:
description: |
    想在前面预览的东西
👆写Front-matter里面

图床

https://blog.youkuaiyun.com/qq_60587635/article/details/137465670
github图床如下↓
https://blog.youkuaiyun.com/qq_44231797/article/details/131658184

评论功能

https://github.com/settings/applications/new
在这里面新建

完语

虽然搭建完了,但是我不知道该挂点什么东西好,随便挂了

我的blog--ddl08.github.io

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值