2020-08-15
Quick answer: edit your _config.yml
file, and add this singular line:
permalink: /posts/:title
That removes the part visible to the reader. (The URL part) The last thing you would have to remove is the date from the filename.
Unfortunately, jekyll is built with the date required in the filename, so you can’t actually remove it.
BUT, there is an easy workaround, and that is to just make another collection.
You could name it something like ‘blogs’ but you can’t name it ‘posts’ because that collection is built in.
Read this stackoverflow post.
This website was built on jekyll, after I finally gave up trying to find the perfect static site generator. I used eleventy for my site, and I remember it did its job well! I remade my whole site in eleventy a couple years ago, but I had one major problem. The problem was that github pages didn’t support serving from a folder in your main website. (for me, eoriont.github.io) This left me with a couple options.
site
or something where I would put my eleventy code.
Then, I’d just stick my compiled html, css, and js into my eoriont.github.io
repository. This method was flawed obviously, because I needed 2 different
repositories for 1 singular project, which would require me to double stage, commit, and push every time I made a change. This option wasn’t going to work.
I ended up going with option 1, and they way I got around the double shenanigans was to just not make any posts at all. :P Luckily, github decided to get their stuff together and add the “serving from folder” feature as a beta feature. Unluckily, I wasn’t aware of this until I decided to completely waste a day relearning jekyll and redoing my site in it. You could imagine how I felt when I finally went to github and it asked me if I wanted to serve from a folder…
Another problem with my site was code blocks. I don’t really know or care what the correct way to add custom css is, so I just kind of added it on top of the theme I have. That screwed a lot of things over, so I fixed it and here’s how:
First, you need some code to format. This is some markdown for a simple line of js:
```js
console.log("hi there!");
```
Now, you have to install a code theme! Go to this example gallery and find something that looks appealing to you, and paste it into a new file called _sass/syntax.scss
. This is obviously a sass file, but it’s fine because jekyll comes with a sass compiler in the box. Now all you need to do is go to the main css file, (mine is in css/style.scss
) and import the sass file, like so:
---
---
@import "syntax.scss";
// other stuff
If you get any compiler errors, it’s likely because the compiler doesn’t like comments. If you have a regex find and replace tool handy, you can past this in to the find to select all the comments: /\*[\s\S]*\*/
Then you would just ‘replace all’ with nothing.
That’s all!