MIKE LEVIN LPVG SEO

Future-proof your tech-skills with Linux, Python, vim & git as I share with you the most timeless and love-worthy tools in tech — and on staying valuable while machines learn... and beyond.

Editing Files That Are The Same Across Multiple Sites

by Mike Levin

Wednesday, May 04, 2022

Okay, the work day is over. Let’s get a little more done on the blogging system. The main thing wrong is the inability to edit everything common to all sites at once and having them automatically pushed on the release. List all the common stuff:

_config.yml
default.html
favicon.ico
index.md
journal.md
post.html
style.scss
youtubePlayer.html

Okay, _config.yml doesn’t apply anymore and I’m going to want to customize favicon.ico for each site (first thing?). So which get copied every time? Oh, these do:

default.html
post.html
style.scss
youtubePlayer.html

Okay, get freer with creating includes, so make an includes directory, put the youtubePlayer.htm in here and adjust the release code to push everything from there into each site’s Jekyll _include folder. Done.

# PUBLISH SITES
figlet Publish Sites... -t
filename='./helpers/sites.txt'
n=1
while read line; do
    figlet $line -t
    cd $line
    cp ../helpers/templates/includes/* _includes/
    cp ../helpers/templates/style.scss assets/css/
    cp ../helpers/templates/default.html _layouts/
    cp ../helpers/templates/post.html _layouts/
    git add --all
    git commit -am "Updating all"
    git push
    cd ..
    n=$((n+1))
done < $filename