the script I wrote for to create a blog from a folder of images and txt
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trav 8df8978357 cleanin up 9 months ago cleanin up 9 months ago cleanin up 9 months ago
template.conf cleaned up for git 9 months ago


It's basically a cron-ed bash script that makes a "blog" from a folder of images and text. It is not perfect by any means, it is a blog by the simplest means. If you have questions feel free to email


  1. create a webadd directory and a webdir directory. Webdir is the site, webadd is images and text to be added.

  2. you might like to share the webadd directory to be able to collaborate with people. Syncthing is recommended.

  3. Within the script:


MAXINDEX sets how long, in # of lines, you want the index.html to be before being archived to another page.

when index.html gets bigger than MAXINDEX, index.html is renamed $currentdate.html and linked to from archive.html. Then ~/template.conf is copied to create a new index.html. Template.conf is basically the header and footer minus all the content in the middle. The template.conf for is included for example.

MAXLOG sets how many lines of the script log you want to hold onto before it is deleted. By default everytime is run it stores most of its output into ~/cronlog.log which isn't precisely a cronlog. But that's what it's called.

when the script is run

The script iterates through files in the webadd directory. Anything ending in .gif, .jpg, .png or .txt will be picked up. .txt files can contain html but you need to escape your own slashes. Which is to say if you put in / in a .txt add a \ before it.

also of note, image files are moved from webadd to webdir under a unique filename to avoid conflicts and .txt files are DELETED after being appended to the index.

the script looks for <!--posts--> inside index.html and adds the new content just below that line. I couldn't figure out adding below the line so it actually replaces <!--posts--> and then adds it back in.

if nothing has changed the site is not re-uploaded

if something has changed, the script runs surge to upload the site. You'll need to configure Surge before running all this. Or just share webdir with a webserver.

automate that shit

you probs want to add this script to your crontab so it auto checks for new images and adds them.


If you run into a Syntax error: "(" unexpected error you gotta run it as ./ and not sh (see stackexchance)

This script was written by trav