当前位置:网站首页>搭建个人主页保姆级教程(二)
搭建个人主页保姆级教程(二)
2022-04-23 01:45:00 【东曜】
干货时刻
hexo个人主页系列教程:本文主要介绍如何设置主题,以及如何编写、上传文章。
next 主题
现在,我们要挑选一款漂亮的主题,笔者推荐先使用next主题。一方面是next集成黑白简约的风格,有助于读者专注于文章的阅读;另一方面就是next社区活跃人数多,现在的8.0版本的主题集成了许多第三方插件的接口,可以方便地进行用户交互、页面美化、站点统计、百度推送等等功能,动态站点有的,它都涵盖得差不多了。
打开个人主页项目的根目录,打开git bash窗口,键入以下代码将next下载到本地的blog/themes路径:
git clone https://github.com/theme-next/hexo-theme-next themes/next

打开根目录下的_config.yml修改主题,该文件为站点配置文件。
# Site
title: 张三的快乐生活
subtitle:
author: 张三
language: zh-CN
timezone: Asia/Shanghai
#把主题改为 next
theme: next
值得注意的是,next主题又分了4种子主题,分别为Muse、Mist、Gemini、Pisces。如何设置呢?
进入路径blog/themes/next,找到_config.yml,这里的_config.yml是主题配置文件。
# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini
作者选的是Gemini,同学们想选哪个就把哪个的注释去掉,可以都试试看看效果,挑一个喜欢的。
设置完成后,在根目录blog下打开git bash,依次键入:
hexo clean
hexo g
hexo s
便可以在本地启动个人网页服务,在浏览器中输入网址:localhost:4000,检验一下你的主题。
我的第一篇文章
我们的硬件设施都准备完毕啦,但是网页上显示的只有hello world这篇文章,该怎么写文章呢?
我们进入blog/source/_posts文件夹,可以看到hello world.md这个项目的初始文章。这个路径就是你的所有文章的保存位置。
目前有两种方式写文章
-
第一种:我们可以用其它
markdown编辑工具(例如Typora)提前编辑好,然后将写好的文章拖到_posts中。然后在根目录打开git bash,键入hexo clean && hexo g && hexo s(或者用VScode打开blog文件夹,在终端中键入hexo clean; hexo g; hexo s,推荐使用VScode维护你的网站,以后我们都以该IDE为标准进行讲解),即可同步到本地网站。 -
第二种:
-
我们提前进入
blog/scaffolds文件夹,打开post.md,将其替换为:--- title: { { title } } date: { { date } } categories: tags: keywords: description: ---这个
post.md就是你的文章的母版,你想做什么统一的配置,都可以在母版编辑。 -
在终端中键入:
hexo new post '我的第一篇文章'这条命令就是用来初始化一篇文章的,其中的
post可写可不写。这样你就可以在_post文件夹中找到我的第一篇文章.md了。写完后,用第一种方法说过的hexo clean ...命令重新生成本地文件,打开localhost:4000,你就可以看到自己的文章啦。
-
部署到 github
OK,现在我们要把本地生成的项目文件统统部署到远程仓库上面去,这样其它人就能访问你的个人主页啦。
首先,我们键入以下命令安装部署插件:
npm install hexo-deployer-git --save
安装完成后,我们进入blog/_config.yml站点配置文件,修改deploy字段:
deploy:
type: git
// repository 替换为你自己的仓库名
repository: [email protected]:dongyaoo/dongyaoo.github.io.git
branch: master
还记得你的github仓库名吗,不记得的同学移步:搭建个人主页保姆级教程(一)。按照上篇教程的方法找到你绑定的仓库名,
配置好后在VSCode终端输入:
hexo d
即可一键部署到 github。那如果有的新手同学在该步骤报错,应该是没设置 git config --global user.email | user.name )。在终端中键入以下命令,重新hexo d一下就行。
git config --global user.email "gitHub邮箱"
git config --global user.name "gitHub用户名"
稍等片刻,在浏览器输入www.dongyaoo.github.io即可访问到你的个人网页啦(记得把dongyaoo替换为你的仓库名)。
这时,你的网站已经上线啦,在别的设备上输入这个网站也能看到你的专属网站~~
结束语
想要学习更多优质内容的同学,关注收藏一下作者的个人主页:东曜说 ~~
版权声明
本文为[东曜]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41911142/article/details/124349483
边栏推荐
- 关于C4D动画如何导入Lumion
- Garlic Junkai company (DFS full arrangement)
- Detonate the bomb (DFS)
- Technology cloud report: cloud computing has entered the "second half". Where is the way out for domestic cloud?
- 2022.4.10-----leetcode.804
- Dimension C China helping farmers in rural areas warms people's hearts the third stop is jiabaoguo farm
- 彻底卸载Antidote 10 ?Antidote卸载不干净怎么办?
- mb_substr()、mb_strpos()函数(故事篇)
- Update description of the latest process engine flowable 6.7.2
- RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimensio
猜你喜欢

关于C4D动画如何导入Lumion

Ziguang micro financial report is outstanding. What does the triple digit growth of net profit in 2021 depend on

Question bank and online simulation examination for safety management personnel of hazardous chemical business units in 2022

2022第六季完美童模 IPA國民賽領跑元宇宙賽道

Challenges often faced by client project management
![[experience tutorial] Alipay balance automatically transferred to the balance of treasure how to set off, cancel Alipay balance automatically transferred to balance treasure?](/img/d5/6aa14af59144b8c99aa6a367479f6b.png)
[experience tutorial] Alipay balance automatically transferred to the balance of treasure how to set off, cancel Alipay balance automatically transferred to balance treasure?

电子采购如何成为供应链中的增值功能?

Solve the problem when installing MySQL

Introduction to PCIe xdma IP core (with list) - mingdeyang science and Education (mdy edu. Com)

Completely uninstall antidote 10? What if the antidote uninstall is not clean?
随机推荐
Error in face detection and signature of Tencent cloud interface
ai2022新功能,illustrator 2022 新功能介绍
Prince saves Princess (DFS)
K zeros after leetcode factorial function
NR polar code VII - SCL (successful cancellation list coding)
领导/老师让填写电子excel表格文档可手机上如何编辑word/excel文件填写excel/word电子文档?
Vscode + PHP debug + namespace guidelines
什么时候应该编写单元测试?什么是TDD?
Garlic customer: equilateral triangle (DFS)
mb_ substr()、mb_ Strpos() function (story)
42. Use k3det in mmrotate for rotating target detection, MNN deployment and ncnn deployment
Realize the function of progress bar through layerdrawable
Futr3d: a unified 3D detection framework for sensor fusion
Technology cloud report: cloud computing has entered the "second half". Where is the way out for domestic cloud?
Challenges often faced by client project management
角色個人屬性英文縮寫
[蓝桥杯][2019年第十届真题]外卖店优先级
Planning garlic guest (outing) (DFS and BFS solution of dyeing block problem)
Problem solving: dpkg DEB: error: package name has characters that are't lowercase alphanums or '- +‘
Blocking granularity of gbase 8s concurrency control