这篇博客是搭设子网站,建立在已经搭好nidemingzi.github.io个人博客的基础上
在用Hexo搭建Github个人主页之后,可能还想搭建一个子网站,那么就需要把站点部署在nidemingzi.github.io的子目录中
需要先新建一个库,创建的方式和之前一样
例如叫做resume,这样一来就可以通过nidemingzi.github.io/resume访问。
找到Hexo的博客文件夹
例如我的文件夹就叫做blog
然后把整个blog文件夹复制一遍
进入副本文件夹的_config.yml文件(用Hexo的朋友应该都很熟悉这个文件了),改两个地方
一是最后面
nidemingzi这个字符串代表你的名字,出现了两遍,把最后的nidemingzi.github.io 这一长串改成你之前创建的库的名字,我举例就用的resume,
第二处是
把url改了,并添加一行root: /你的库的名字/,其余不变
# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: https://nidemingzi.github.io/resume
root: /resume/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
trailing_index: true # Set to false to remove trailing 'index.html' from permalinks
trailing_html: true # Set to false to remove trailing '.html' from permalinks
这样一来就相当于拥有了两个独立的Hexo博客,在副本文件夹里hexo c,hexo g,hexo d就可以了