【英文版】在Ubuntu 22.04使用Jekyll搭建Chirpy主题的个人博客网站

原始发布链接

What is Jekyll

Here is the official statement.

Jekyll is a simple, blog-aware, static site generator perfect for personal, project, or organization sites. Think of it like a file-based CMS, without all the complexity. Jekyll takes your content, renders Markdown and Liquid templates, and spits out a complete, static website ready to be served by Apache, Nginx or another web server. Jekyll is the engine behind GitHub Pages, which you can use to host sites right from your GitHub repositories.

For more information, see Jekyll’s official site and its GitHub repo.

Install Jekyll

Install Ruby and other prerequisites:

$ sudo apt update
$ sudo apt install gcc build-essential ruby ruby-full zlib1g-dev

Ruby version must be 2.5.0 or higher, including all development headers (check your Ruby version using ruby -v)

Avoid installing RubyGems packages (called gems) as the root user. Instead, set up a gem installation directory for your user account. The following commands will add environment variables to your ~/.bashrc file to configure the gem installation path:

$ echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
$ echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
$ echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc

Then, install Jekyll and Bundler:

$ gem install jekyll bundler

Check your installation:

$ Jekyll -v
$ bundler -v

Install Chirpy theme

Here is the demo and GitHub repo of Chirpy theme.

To get the theme from GitHub, git is needed:

$ sudo apt install git

Create a new directory and clone the chirpy-starter:

$ mkdir blog
$ cd blog
$ git clone https://github.com/cotes2020/chirpy-starter.git
$ mv ./chirpy-starter/* .
$ rm -rf chirpy-starter
$ bundle
$ bundle add webrick

Deployment

Here I use apache2 (i.e. httpd) to deploy my site.

$ sudo install apache2
$ sudo systemctl enable apache2
$ sudo systemctl start apache2

In the root directory of your blog, run the following commands:

$ echo "#"\!"/bin/bash" > deploy.sh
$ echo "jekyll b" >> deploy.sh
$ echo "sudo rm -rf /var/www/html/*" >> deploy.sh
$ echo "sudo cp -r ./_site/* /var/www/html" >> deploy.sh
$ echo "echo \"Deploy success"\!"\"" >> deploy.sh
$ sudo chmod 775 deploy.sh

Now you can run this script to depoly your site using apache2:

$ ./deploy.sh

Customization and others

Official tutorial:

Customize the Favicon

Writing a New Post

Text and Typography

Enable Google Page Views

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值