Posting to Jekyll : Workflow
How to do things in order
1. Installation :
- Ruby
- install
sudo apt-get install ruby-full build-essential
- check version :
Ruby -v
- install
- Install Jekyll : run
gem install jekyll bundler
- run
jekyll new blogname
- go into the directory where you created teh site
cd blogname
- ` bundle exec jekyll serve
and hten can just type
jekyll serve` after teh first time
2. Inforamtion about the files in teh jekyll site foldres/stuff :
- the site folder : stuff related to the blog. this holds the finished final website (that you put on a web server). dotn modify too much in here, it gets modified by itself
- the post folder : your markdown posts
- the yaml config file : important values for the site
- the gem file : stores dependencies, for example the
theme
.
3. Front Matter :
layout : post
title : "Post Title "
date : 20240-04-04 15:34:30 -0200
categories : jekyll update (the category it gets updates, so changes teh folder it's saved in)
can create own categories like author
, etc some other elements :
- permalink : “/new-url” or permalink:/categories or good idea to define a permalink for each post so that they dont break in case you change a date or somethign later on.
1
2
3
4
5
6
7
8
9
layout: post
permalink: /blog/my-first-post/
slug: index.html
title: My first blog post
date: 2020-01-31 07:30 +0000
last_modified_at: 2024-01-16 12:01 +0800
category: [category1, category2]
tags: [tag1, tag2, tag3]
excerpt: This is the first blog post for my Jekyll site.
1
2
3
4
5
6
7
8
9
10
11
12
Attribute Description
layout: The Jekyll layout file to use.
Options: page, post, archive, category-list and tag-list.
Note: page-right-sidebar and post-left-sidebar are deprecated.
title: The title of the page or post.
date: The date here overrides the date from the name of the post file. *Note: A date is specified in the format YYYY-MM-DD HH:MM:SS +/-TTTT; hours, minutes, seconds, and timezone offset are optional.*
last_modified_at: (Optional) The date when the post was the last modified: *Note: A date is specified in the format YYYY-MM-DD HH:MM:SS +/-TTTT; hours, minutes, seconds, and timezone offset are optional*.
permalink: (Optional) The custom URL for the page or post, if you need your processed blog post URLs to be something other than the site-wide style. Default: /year/month/day/title.html.
slug: (Optional) The custom name for the page or post file, if you need your processed blog post file names to be something other than the original name. Default: The original file name. "Note: If the permalink option is set to a string that ends with /, you need to set the slug option to " " or index.html to avoid generating an invalid URL for the site preview feature of Front Matter CMS."
category: (Optional) One or multiple categories that the post belongs to.
tags: (Optional) One or multiple tags that the post associates with.
excerpt: (Optional) The short text to show on the card of the list/grid of posts, and use as the meta description of the page or post.
4. Building a default Front Matter through yaml config
file under #build settings
:
defaults: - scope: path: "" type: "posts" values: layout: "post"
:::info Note that :
- if you dont specify layout in a post/page, it’ll go to THIS default. but if you type a default layout manually into a front matter it’ll supercede the default.
- :::
5. Themes :
- (rubygems.org to get the theme name)
- go into the
Gemfile
- in teh
Gemfile
go to thetheme
section and below the deafult (minima) add :gem "theme-name (wahtever the name is)"
- go into terminal :
bundle install
inorder to install all teh gems, including new one - restart jekyll server
bundle exec jekyll serve
- the new theme might not have teh same layout elements as before, which woudl break things. so have to check the new theme’s “defaults” document/file.
6. Hosting on GitHub :
- create new repository, public and DONT
initialize with README
- modification of
yaml
config file :baseurl
which is the urlof the site/file so here on github pages it’d berep_name
otherwise the url of the page on custom domain name - go into Git : ```bash! git checkout -b gh-pages #switches to github pages branch git add . #prepares all teh filres to be added to the repo git commit -m “initial commit “ #commits this files to teh repo with teh title git remote add origin https://github … /blogname.git #to keep connected to the local git push origin gh-pages #to push to the GH repo
#each time there is a change to commit git commit -m “commit message” git push origin gh-pages ``` the link for the blog then becomes zloopy.github.io/blogname
This post is licensed under CC BY 4.0 by the author.