Massaging 10 Sites Into Shape At Once

by Mike Levin

Friday, April 29, 2022

Okay, I just removed stopwords from Jekyll blog post URLs. I did it quite easily borrowing some code I recently did for mlseo. And next I think I want to roll the advances out across all my sites that could benefit. Okay, so do it!

I just did whatsametafor.io. There were some interesting steps that I have to remember:

Do https://linuxpythonvimgit.com/ next and update that check-list. Also instead of venturing into all these different Github.io templates (a mistake) focus on one single template (hacker) so that you can move forward across all sites more rapidly. Sure, they’ll all look the same at first, but I can focus later on divergence. It’s convergence right now that accelerates the process.

Okay so let’s do this thing.

Ugh! Do this for every folder at once. Okay, so I put some “source” files into my helper folder, such as a sample _config.yml and index.md file. Then I execute this script from Linux on Windows. Because of the use of git in the commands, it is not an appropriate script to run from JuptyerLabs on Windows.

from subprocess import run
from pathlib import Path


sites = """guerillatech
linuxpythonvimgit
lundervand
mike-levin
mikeateleven
pipulate
pythonically
removablefinger
tardigradecircus
tictacufosightings
whatsametafor""".split('\n')

ghp = "/mnt/c/Users/mikle/github/"

for site in sites:
    Path(f'../{site}/_posts').mkdir(exist_ok=True)
    print(site)
    if not Path(f"{ghp}{site}/index.md").is_file():
        run(["cp", "index.md", f"{ghp}{site}/"], cwd=f"{ghp}helpers/")
    run(["git", "add", "_posts"], cwd=f"{ghp}{site}/")
    run(["git", "add", "blog.md"], cwd=f"{ghp}{site}/")
    run(["git", "add", "index.md"], cwd=f"{ghp}{site}/")
    run(["cp", "_config.yml", f"{ghp}{site}/"], cwd=f"{ghp}helpers/")
    run(["git", "add", "_config.yml"], cwd=f"{ghp}{site}/")
    run(["git", "commit", "-am", "Added _posts"], cwd=f"{ghp}{site}/")
    print()