MIKE LEVIN AI SEO

Future-proof your skills with Linux, Python, vim & git as I share with you the most timeless and love-worthy tools in tech through my two great projects that work great together.

Massaging 10 Sites Into Shape At Once

I recently optimized my Jekyll blog post URLs by removing stopwords, and I wanted to roll out the changes across all my sites. To make the process faster, I created a script that I could execute from Linux on Windows. With this script, I was able to quickly and easily make the same changes across all my sites. Read more to learn how I did it.

Speed Up Site Optimization: How I Massaged 10 Sites Into Shape At Once

By Michael 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()

Categories