版权声明:本文为博主原创文章,未经允许也可以任意转载。http://huyouxiao.com https://blog.csdn.net/fudaxing/article/details/87891845
验证有没有安装 ruby 和 gen
ruby -v
gen -v
安装 jekyll bundler
sudo gen install jekyll bundler
jekyll -v
创建一个工程
jekyll new yourProjectName
启动服务浏览工程
cd yourProjectName/
bundle exec jekyll serve
访问地址就可以看到了:
http://127.0.0.1:4000/
新建_draft文件夹,在里面编写不带日期的 md 文件。编写完后浏览效果
jekyll serve --draft
permallink是header里面用于指定访问路径的属性。
---
layout: post
title: "Welcome to Jekyll!"
date: 2019-02-23 14:21:17 +0800
categories: jekyll update
author: "Kevin"
permalink: /:categories/:year/:month/:day/:title.html
---
这篇博文的URL就是/categories/year/month/day/title的形式:
http://127.0.0.1:4000/jekyll/update/2019/02/23/welcome-to-jekyll.html
_config.yaml是 yaml 语法的配置文件,通过代码缩进决定配置的嵌套关系,默认的主题是minima,也可以换主题,主题库: https://rubygems.org/
先把_config.yaml文件里面的主题
theme: jekyll-theme-hacker
然后在 Gemfile 文件 的第 14 行文件插入
gem "jekyll-theme-hacker", group: :jekyll_plugins
接着运行命令 bundle install 下载这个主题
bundle install
接着运行命令预览效果
bundle exec jekyll serve