搭建 Jekyll 运行环境

发布于 2022-03-28 13:23:57 字数 5240 浏览 1113 评论 0

1. 安装 RubyGems

apt-get install rubygems

2. 安装「Jekyll」

$ gem install jekyll
Fetching: liquid-2.6.1.gem (100%)
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /var/lib/gems
$ sudo gem install jekyll
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.
$ gem update --system
ERROR:  While executing gem ... (RuntimeError)
$ sudo gem update
Updating installed gems
Updating rdoc
......
27 gems installed
$ gem install jekyll
......
Successfully installed jekyll-2.4.0
26 gems installed
$ jekyll -v
Could not find a JavaScript runtime.
$ sudo apt-get install nodejs
$ jekyll -v
jekyll 2.4.0

3. 测试 Jekyll

$ jekyll new my-awesome-site
$ cd my-awesome-site
~/my-awesome-site $ jekyll serve
# => Now browse to http://localhost:4000

打开浏览器可以看到:

使用「JekyllBootstrap」

The Quickest Way to Blog on GitHub Pages. Jekyll Generates Static Websites

1. 使用 Jekyll + GitHub Pages 快速生成博客

  1. Create a New Repository
  2. Install Jekyll-Bootstrap
  3. Profit

2. 利用 Jekyll 进行本地调试

直接下载 jekyll-bootstrap 模板

$ git clone https://github.com/plusjade/jekyll-bootstrap.git
$ cd jekyll-bootstrap
$ jekyll serve

Your blog is now available at: http://localhost:4000/

下载/运行别人已经做好的模板

$ git clone git@github.com:liqing215/note-blog.git
$ cd note-blog
$ jekyll serve
Error:  Address already in use - bind(2)

这个错误是因为在另外一个在和终端里面也运行了 jekyll serve,关掉之后在打开就可以看到自己的博客了。

$ jekyll serve
CNAME already taken: ......

这个错误是因为 CNAME 文件的原因,是用来指定自定义域名的,和本地调试地址冲突。如果你没有自定义域名,那就不需要删除。

3. Markdown 写作

本地写作

UberWriter:a MarkDown Editor for Linux

sudo add-apt-repository ppa:w-vollprecht/ppa
sudo apt-get update
sudo apt-get install uberwriter

只需要在 _posts 文件夹下添加相应博文的 .md 文件即可,注意命名格式一定要是 yy-mm-dd-title.md,title 是你文章的标题。(也可以卸载 .md 文件开头)

每篇文章的开头都要指定一定的格式,如本文:

layout: post
title: "Ubuntu开发之旅[4]:写作环境的搭建(Jekyll+GitHub+Markdown)"
category: 技术
tags: Ubuntu
keywords: Ubuntu,Jekyll,GitHub,Markdown
description: null
published: true
  • layout: post 指的是博文格式要按照_layouts 文件夹下的
  • post.html 指定的格式来显示。
  • categories: 指定博文分类技术。
  • tags: 指定博文标签。
  • published: 表示发布与否

线上写作

在线 Md 编辑器:

1.马克飞象- 专为印象笔记打造的 Markdown

2.StackEdit – In-browser markdown editor

3.Cmd Markdown 编辑阅读器 - 作业部落出品

Prose · A Content Editor for GitHubProse,Prose is a content editor for GitHub designed for managing websites. Learn more. Authorize on GitHub.

最终就选择了 Prose.io 直接在线编辑修改 GitHub 上的文章,无比方便。

其他的快速「博客」方案

1. Postach.io

Collect and share content from your favourite apps.

Connect and post using Evernote, Dropbox and Pocket.

When you add or change an HTML, Markdown, or Image file in the folder for your Postach.io site in Dropbox, that change will be reflected on your Postach.io site after Dropbox is finished syncing. It’s that easy.

2. Farbox

The Best Blog Platform on Cloud

Realtime and dynamic, Folder is a database, FarBox is a webserver. Simple is Everything.

3. Medium

Medium is a new place on the Internet where people share ideas and stories that are longer than 140 characters and not just for friends.

4. 简书

找回文字的力量 在这里更好地写作和阅读

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

关于作者

JSmiles

生命进入颠沛而奔忙的本质状态,并将以不断告别和相遇的陈旧方式继续下去。

0 文章
0 评论
84959 人气
更多

推荐作者

花开柳相依

文章 0 评论 0

zyhello

文章 0 评论 0

故友

文章 0 评论 0

对风讲故事

文章 0 评论 0

Oo萌小芽oO

文章 0 评论 0

梦明

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文