linux fedora 24 jekyll 搭建 github blog

output

linux fedora 24 jekyll 搭建 github blog

input

需要 github 帐号

baidu jekyll github
http://www.ruanyifeng.com/blog/2012/08/blogging_with_jekyll.html

markdown syntax
https://daringfireball.net/projects/markdown/syntax
Headers

algo

  • 创建 github repo
    命名 repo 为 blog
    勾选 Initialize this repository with a README (新手建议)
  • 创建 本地 repo
repo=blog # 这里就是你的repo命名
mkdir ${repo}
cd ${repo}
git init
git checkout --orphan gh-pages
echo "baseurl: /${repo}" > _config.yml
cat _config.yml

mkdir _layouts
cd _layouts
echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>{{ page.title }}</title>
</head>
<body>
{{ content }}
</body>
</html>' > default.html
cat default.html

cd ..
mkdir _posts
cd _posts
echo '---
layout: default
title: 你好,世界
---
# hi' > 2016-11-22-hello-world.markdown
cat 2016-11-22-hello-world.markdown

cd ..
echo '---
layout: default
title: 我的Blog
---
<h2>{{ page.title }}</h2>
<p>最新文章</p>
<ul>
{% for post in site.posts %}
<li>{{ post.date | date_to_string }} <a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>' > index.html
cat index.html
  • 本地测试下
#当前目录是你的blog目录
jekyll s
  • 发布内容到github
    ctrl+c 中断 jekyll 服务
git add .
git commit -m "go"
git remote add origin https://github.com/你的帐号/${repo}.git
git push origin gh-pages

访问 https://你的帐号.github.io/blog

sum

  • 关于 headers 解析,kramdown 解析器需要 # 后空格 (csdn解析器不用,这里好评)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值