Blog Update: The site has working images now.
I got images working now on the site. They were working locally, but when I made it live on GitHub pages it was a bit frustrating getting the links and images to use the correct URL. I couldn’t find good documentation on the project name vs the base URL. I ended up updating the “_config.yml” file on these lines:
url: "https://jake-olsen.github.io/"
baseurl: /blog
Then updating the images in my posts to this code:
<img src=”{{site.url}}{{site.baseurl}}\assets\images\filename.webp>
site.baseurl was just a guess since I didn’t see on the Jekyll documentation or the other posts I saw while searching comments on GitHub where other people were having a similar problem.
After playing around with trying to optimize images for the web. I would resize them to about the size they would appear on the blog. Somewhere around 900 or 1000 pixels wide. Strangely the file sizes got bigger. I just left the original screenshots since they were the smallest file size. The photos of the cisco lab are a bit bigger, so shrinking the overall size did significantly help the page load faster. Some of them were still large file sizes. Google recommends saving them as webp, but Paint.NET doesn’t have an option to save images as webp.
I went to go look for software on Chocolatey since they usually have pretty good software, and I found the webp program from google surprisingly it is command line only, but easy to use. https://developers.google.com/speed/webp/docs/using
I'll just open a command prompt as an admin and install webp.
Then I just used the default example from google to optimize the photo.
Which worked out very well. It took the image from 4000+ KB down to 99KB!
I wanted to try it out on a few other images to see if I could get better quality and have a smaller size. I cropped it inside of Paint.NET for it to be easier. Then I had to trial and error a bit to get the command correctly.
Original File before Crop 3,000KB .jpg
File after crop 12,000KB .png
File after cwebp resize and optimization 80KB .webp
Some images don’t decrease their file size, so I just leave them as their original png if the webp format ends up being larger.
Test it locally before uploading by serving locally
Then viewing http://127.0.0.1:4000/blog/ in a web browser and make sure the updates are working as expected before uploading.