jekyll post
This commit is contained in:
parent
e0a30c71d7
commit
545643a5c3
41
_posts/2025-03-21-generate-a-website-with-jekyll.md
Normal file
41
_posts/2025-03-21-generate-a-website-with-jekyll.md
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
author: Sam Hadow
|
||||||
|
---
|
||||||
|
|
||||||
|
Finally decided to serve posts on my website generated with Jekyll, so without any surprise my first post is about [Jekyll](https://jekyllrb.com/).
|
||||||
|
|
||||||
|
## Why Jekyll?
|
||||||
|
Mainly for simplicity. Jekyll lets you build a static website from markdown files. No database to manage and no interaction between the back-end and front-end to manage. As long as my NGINX is up to date and working, my website is working. Also a lot more lightweight both for the server (since only NGINX is needed to serve the files) and for the clients (since it's not suffering from JavaScript bloat).
|
||||||
|
|
||||||
|
One downside being it's obviously harder to handle interactions with clients since it's not made for this. In particular enabling comments under blog posts is not as straightforward although it's still possible by hosting a comment system. However, I didn't look how to install and integrate a comment system with Jekyll yet as it's not a feature I need for now.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
I decided to [install](https://jekyllrb.com/docs/installation/) a ruby development environment directly on my system, although you could use [containers](https://github.com/envygeeks/jekyll-docker/blob/master/README.md) is you prefer.
|
||||||
|
|
||||||
|
I installed ruby and have the following in my .bashrc file to use gems (RubyGems) to use it as an unprivileged user and not the root user.
|
||||||
|
```
|
||||||
|
# Install Ruby Gems to ~/gems
|
||||||
|
export GEM_HOME="$HOME/gems"
|
||||||
|
export PATH="$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH"
|
||||||
|
```
|
||||||
|
|
||||||
|
To install Jekyll:
|
||||||
|
```
|
||||||
|
gem install jekyll bundler
|
||||||
|
```
|
||||||
|
(bundler is used to keep track of the depencies of each Ruby projects independently)
|
||||||
|
|
||||||
|
To create a new Jekyll project:
|
||||||
|
```
|
||||||
|
jekyll new site-name
|
||||||
|
cd site-name
|
||||||
|
```
|
||||||
|
|
||||||
|
Then during development I can just serve the website on a development machine and see if the results look good with:
|
||||||
|
```bundle exec jekyll serve```
|
||||||
|
If it looks good enough I can commit and push the website code and then deploy it on my server. To deploy it on my server I should automate things a bit more but for now I just have a make target to build the website and a make target to copy the files from _site to /var/www/html.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user