Jekyll is a popular static website generator, often used for blogs and personal websites. Since all the content it generates is static, it makes for very fast and simple websites.
Set up your site¶
-
Go to either our web-based SSH client or a terminal (using [[SSH|doc services/shell]] to connect to
ssh.ocf.berkeley.edu) and sign in with your OCF username and password. -
Create a new directory for your Jekyll project and name it whatever you want, then enter that directory:
- Install the Jekyll gem and set up your site. Note that the specific jekyll
path is only needed for setup since jekyll is being installed for only your
user, but after this setup, you can just add
bundle execbefore any jekyll-related commands to get them to work:
user@tsunami:~/jekyll$ gem install --user jekyll
# The path used for jekyll below should be printed out as a warning when you
# install jekyll using the above command, it'll be something like
# "/home/u/us/username/.local/share/gem/ruby/2.7.0/bin/jekyll" but can vary
# by Ruby version. Use `gem environment` to find the appropriate path.
user@tsunami:~/jekyll$ ~/.local/share/gem/ruby/2.7.0/bin/jekyll new --skip-bundle .
user@tsunami:~/jekyll$ bundle config set --local path 'vendor/bundle'
user@tsunami:~/jekyll$ bundle install
Deploy your new site¶
-
Change the
baseurloption in_config.ymlfile to the path you want your site available at. This is likely something like"/~username"or"/~username/blog"(make sure to replaceusernamewith your username!). -
Build the site in
~/public_html(make sure to also run this whenever you make changes to your site and want to publish them). This path should match whatever you used for yourbaseurloption, so if you chose"/~username"there, then use~/public_htmlhere, if you chose"/~username/blog"then use~/public_html/bloghere instead:
- Your site should now be up at
https://www.ocf.berkeley.edu/~username(or whatever path you chose previously).
Quick Start Guide¶
We've just created a default template site. Let's see how to customize it a bit to make it yours:
- On your site, there should be a new welcome post (at some path like
https://www.ocf.berkeley.edu/~username/jekyll/current-date/welcome-to-jekyll.html). This contains instructions on how to add a new post, but we've summarized the instructions below:
In your site directory (jekyll for instance), there should be a
subdirectory named _posts. Blog posts go there by default as Markdown
files. Please follow the sample post file there to make your own (note the
YAML header at the top in between --- markers and the file name format with
the date and a title).
-
Other than blog posts, you can also make other pages (about, contact, etc.) that are linked at the top right of the site. An example is the
about.mdfile already placed in your site directory (note the YAML header withlayout: pageto specify which layout to use). -
The
_config.ymlfile in your site directory contains global site settings, where you can change the title of the site among other settings.
Advanced Guide¶
For more advanced setup, please see the Jekyll Docs.
Here are some docs that might be of interest:
-
Using a different theme (Note that different themes might not be compatible with each other; the YAML header format might be different, for instance)