These instructions explain how to temporarily hide the TC Direct buy links on the local tcmc.se website, then restore them when tcdirect.se goes live.
This page is only an instruction sheet. You also need the
toggle_buy_links.py script supplied separately.
The commands below assume it is saved in your Downloads folder.
Website folder:
/Users/mark/Dropbox/TC Websites/SE Website
Python script:
/Users/mark/desktop/toggle_buy_links.py
Keep the double quotes around paths in the commands below. They allow Terminal to handle folder names containing spaces.
To check that Python 3 is available, enter:
python3 --version
You should see a Python 3 version number. If Python 3 is not installed, install it from python.org, then reopen Terminal.
Copy this entire command, paste it into Terminal, and press Return:
python3 "/Users/mark/desktop/toggle_buy_links.py" hide "/Users/mark/Dropbox/TC Websites/SE Website"
The script will:
.html and .htm files.buy that point to
tcdirect.se or www.tcdirect.se.
Both the link and its text will disappear from the displayed page. Running the hide command again will not hide the same links twice.
Check a few local pages in your browser, then upload the modified HTML files to tcmc.se. Running this script does not update the live website automatically.
Open Terminal again. Copy and run this command:
python3 "/Users/mark/desktop/toggle_buy_links.py" restore "/Users/mark/Dropbox/TC Websites/SE Website"
The script will replace its specially marked comments with the original links. It does not remove ordinary HTML comments.
Check that the links are visible and work correctly, then upload the restored HTML files to tcmc.se.
<!-- TCDIRECT_BUY_HIDDEN:.
They contain the saved links needed for restoration.
“Can't open file” or “No such file or directory”:
Check that the script really is in Downloads and is named
toggle_buy_links.py, not
toggle_buy_links.py.txt.
“The website folder does not exist”: Check the website folder path, and keep the surrounding double quotes.
Handy tip: Drag a file or folder from Finder into Terminal to insert its path with spaces handled automatically. Terminal may use backslashes before spaces instead of surrounding quotes; that is normal.
Because the commands above use full paths, you can run them from any current folder in Terminal.