Hey there
Long time no see.
I’ve been busy importing, editing and deleting thousands of old notes. There were a lot of dead links and missing image files.
A couple of months ago, I created a small Alfred workflow that tries to prevent this from happening again. It’s coming in handy right now.
Even if you don’t want to use Alfred (or macOS), maybe you can check the source scripts for inspiration.
Hope this helps (someone else besides me). Cheers!
About Glass Dome
Inspired by Jeff Huang’s manifesto Designed to Last, Glass Dome is an effort to prevent link rot inside markdown notes.
It uses the Internet Archive’s Wayback Machine and your own Dropbox account to preserve three kinds of link:
- Webpages
- Inline images
- File attachments
Setup
You need Alfred with its paid Powerpack to use this workflow. For years now, Alfred has been the single most important productivity app on all my macs, so I couldn’t recommend it enough.
To use image and attachment functionality, you’ll also need a (free) Dropbox account. The web archiving feature doesn’t need anything and works out of the box.
Download the workflow file, double-click on it and define the following two variables in the dialog that pops up:
db_token (Dropbox Token)
Fill in “db_token” with your Dropbox authorization token. Go here:
Create an app (name it whatever you like) and generate a token.
db_folder (Dropbox Folder)
This is the folder in which Glass Dome will place your uploaded files and images. If it doesn’t exist, it will be automatically created on first use.
Files are never overwritten: they are timestamped to the second, and the API call is set to auto-rename.
How to use
Each of the three actions is triggered by a keyword (feel free to change those, by the way).
-
gdw (Webpage): It creates Wayback Machine snapshots of any URL passed to it and returns markdown links for both live and saved versions. If no URL is passed, it tries to detect the frontmost Safari tab.
-
gdi (Image): Gets selected image file (in Finder) and copies it to a folder in Dropbox (you have to set in the workflow’s Environment Variables). Then, it returns a markdown image link to that file. You can pass it an optional description that will be used as alt-text.
-
gdf (File): Pretty much the same as the previous one, but for any other file type.
Once the markdown link is in your clipboard, you can paste it anywhere you want.
- Web links will be appended with a ⟲ icon, which you can click to visit the snapshot
- Images will render inline (where supported, of course)
- File links will link to the Dropbox copy of the original local file. (Bonus: those links won’t break even if you move the file to another Dropbox folder.)
A couple of warnings
- This is a very basic workflow put together in a day, with very limited programming knowledge. I made it for my own use, but then figured it might be useful to someone else. It’s not elegantly crafted, and it won’t be regularly maintained. It seems to work, though.
- I can’t imagine how this workflow could break anything. But I may be wrong.
Comments or suggestions?
Email: [email protected]
Twitter: @senhortavares