搭建hexo—–比较慢
安装软件
创建空文件,用git命令敲, hexo init
文件创建命令
hexo n “文章名字“ 创建文章
hexo generate 重新生成文件
hexo clean 清理
hexo deploy 传到远端
上传github访问
建一个仓库,
打开__config文件最下面添加仓库路径
hexo deploy传到远端 登录一下github账号密码就行了
更换主题
Hugo—-比较快
如何添加文章呢?
新建文件项
code 创建文件,创建文件内容,在hugo/blog/config.toml下209行添加目录项,mainSections=“添加新目录名称”,修改下面的图标themes/meme/data/SVG.toml,参考https://io-oi.me/tech/documentation-of-hugo-theme-meme/#%E5%9B%BE%E6%A0%87
- 新建文章
我的博客目录: url = “/read/” url = “/tool/” url = “/life/” url = “/thought/” url = “/about/”
由于 Hugo 并不会提供默认的示例文章,所以如果你想在安装和配置完后立即体验 MemE 的话,还需新建一篇文章和一个关于页面,修改文章内容:
|
|
- 现在编译:
|
|
不到 100 ms 后,打开 http://localhost:1313/,恭喜你!你已经成功在本地搭建好博客了🎉🎉🍻!尽情享受 MemE 的简约和 Hugo 的飞速吧🚀!
3.传到远端
-
hugo 编译
-
cd public
git add .
git commit-m “版本信息”
git remote add origin https://github.com/Kurby96/Kurby96.github.io.git
git push -u origin master
有时候还需要输入账号密码
git config –global user.email “2256925632@qq.com”
git config –global user.name “kurby96”
如果提示error: remote origin already exists.用git remote rm origin
若提示,$ git push -u origin master
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
输入,ssh-keygen -t rsa -C “2256925632@qq.com"到C:\Users\12988.ssh\id_rsa.pub文件复制到下图中
如果没显示再到https://www.netlify.com/,查看
添加自己的域名,http自动认证一下就行了,如果还有问题,看一下自动更新设置没,没有重新设置一下
注意事项:
+++
title = "如何添加新文章到博客"
tags = ["hugo"] ##标签
date = 2020-10-26T12:20:44+08:00
draft = false ##true是隐藏文章,本地可以查看,外网访问是隐藏的,改成false就能显示了
comments = true ##评论系统,本地查看不了
slug = "SSL证书失效" ##这个是网页显示的链接,如slug = "SSL证书失效" https://www.kurby.top/tool/SSL证书失效
+++