#!/usr/bin/env bash # This script will publish the compiled output of the blog # as it is now in this directory. # It could be futher improved by taking this version, # making a git branch at this point, or a git tag # to enable rollbacks. # Make errors be fatal set -e WEBSITE_URL="https://n07070.xyz" echo ">> Update the remotes..." # Last blog version git pull origin master # Get last theme version git submodule foreach git pull origin main # Dither images present in the blog, moving the existing images to filename_original.jpg # Commented, because colors is nice, and dithering actually brings more issues than it solves: # Images size tends to be bigger, relative to quality, # It's not easy for some people to see the image that way, # It's more trouble than it's worth. # echo ">> Dithering the images..." # ## Travel down the directory content/ # find "./content" \ # Find from the content directory # -maxdepth 4 \ # Maximum depth of 4 dirs # -type f \ # Find only files # -name "*.jpg" \ # Find only JPEG files # -exec \ # Execute next lines # cp {} {}.original && \ # Copy file and add .original to it's filename # convert {} -colorspace GRAY -o ordered-dither o2x2 {} &&\ # Dither image # jpegoptim {} -S 80 -t ; # Optimize the jpeg file # Generate the openring ( https://git.sr.ht/~sircmpwn/openring ) echo ">> Generating the openring..." openring -s https://www.laquadrature.net/feed -s https://blog.mondediplo.net/rss/ -s https://solar.lowtechmagazine.com/feeds/all-en.rss.xml < themes/blogotheme/layouts/partials/openring-in.html > themes/blogotheme/layouts/partials/openring-out.html echo ">> Building the website..." hugo --themesDir themes --theme blogotheme --baseURL="https://n07070.xyz" --enableGitInfo --minify --templateMetrics echo ">> All done !"