Jekyll 配置 & Next 主题教程

Jekyll是一个静态博客编辑器,可发布在任何服务器上,操作简单便捷,这里主要介绍使用github主页打造个人blog。基于macOS操作系统。

Jekyll安装过程

  • 安装jekyll

 sudo gem install bundler jekyll

  • 检查jekyll版本

 jekyll -v

这里我在安装过程中出现了各种路径问题,需要额外的终端命令行来完成完整的安装。
对于一般路径问题在命令前加sudo获取权限就能很好的解决。

博客测试

jekyll能快速生成博客环境搭建,不需要掌握复杂HTML技术。

jekyll new blog
cd blog
jekyll serve
  如果安装过程顺利,会出现以下提示:

 Server address: http://127.0.0.1:4000/

  这时你的临时博客就会出现在http://127.0.0.1:4000/ 中,按住crtl+c终止。
到目前,测试工作已经完成。

利用Github搭建个人博客

首先,需要创建一个Github账号,并且建立新的repository来做为网站的地址。
新的repository的名字为your-blog-name.github.io

  • 克隆你的repository到本地目录,便于上传。

 sudo git clone [git-repository-address]  

  • 复制你本地blog生成目录中的文件到你克隆的本地repository中。

一般地址为cd /Users/your-admin-name/...

  • 复制完成后将内容上传至Github:

首先需要进入到本地克隆的repository地址,一般为:

 cd /Users/your-admin-name/your-blog-name.github.io

输入以下命令:

 sudo git add --all
 sudo git commit -m "first_commit"
sudo git push

  • 所有工作完成✅

到这一步,如果你的your-blog-name.github.io仍然为404,请不要着急。
休息下眼睛,伸展身体,过几分钟自然会成功。  

jekyll 支持各类自定义主题,可供大家选择。找到心仪的主题,并自己作出适合自己的更改更是jekyll乐趣之一。

主题加载

这里提供一个下载主题的网站:

http://jekyllthemes.org