Squarespace export
We run mirror.sh
three times because Squarespace is finicky and tries to deny access randomly. wget
will ignore files that have already been retrieved in the subsequent rounds.
One quick way to check if all files are there is to look at the etching-
files; there should be 23. A complete list of all files (excluding third-party domain page assets) can be found on the sitemap.
rm -rf docs && mkdir docs && mkdir docs/files && mkdir docs/files/assets
./mirror.sh && ./mirror.sh && ./mirror.sh
./copy.sh
My regexfu failed me when combined with capture groups and sed
and its many (nonstandard) (annoying) idiosyncrases. So then we need to do manual find and replace across the 'docs' files in Sublime Text (with regex enabled):
From | To |
---|---|
(href|src)="[\.\.\/]*s\/ | $1="\/files\/s\/ |
(href|src)="[\.\.\/]*static1.squarespace.com | $1="\/files |
(href|src)="[\.\.\/]*images.squarespace-cdn.com | $1="\/files |
(href|src)="[\.\.\/]*assets.squarespace.com | $1="\/files\/assets |
[\.\.\/]+universal | \/files\/universal |
(href|src)="[\/]*[\.\.\/]* | $1="\/ |
Then for the simpler rewrites, run:
./rewrite.sh
A few pages benefit from specific fixes that we were never able to do within Squarespace. Using Sublime Text (with regex enabled), find and replace in these files:
- Open the deeply-nested
site.css
file and add the following to the top:
@import "/files/manual/fonts/stylesheet.css";
@import "/files/manual/additions.css";
about/testimonials.html
: replace<p class="entry-more-link">.*</p>
with nothingmultietch-blog.html
: replace"baseUrl":"https://www.multietch.com"
with"baseUrl":"/"
Run Linkchecker from the command line, on a local or hosted version of the exported site, to determine broken links. Commands:
linkchecker --no-robots -F html --ignore-url='/tag' --ignore-url='/category' <siteurl>`
linkchecker --no-robots -F csv --ignore-url='/tag' --ignore-url='/category' <siteurl>`
The latter of these was used to create brokenlinks.csv
which can be used to manually, tediously, update broken images. (Be sure to do a search/find for all instances of the broken image, not only the instance it found, as it can overlook things like meta tags or JS files.)
-
Any embedded videos that were using custom image overlays in Squarespace need to be re-embedded directly. We could use other (non-SS) libraries in the future to have custom image overlays again, but we don't need that right away.
-
Slideshows don't show controls consistently and were always substandard anyway, so they need to be fully replaced.
-
Contact forms (contact page and "keeping etch times consistent" page) need to be replaced with a non-SS option.
Minifying can be useful if you're running find-replace on multiple lines and don't want to worry about whitespace matching. It's also, of course, the natural state we should be serving HTML.
To minify all files from docs/
into a separate directory called minified/
install the binaries for tdewolff/minify and run:
~/bin/minify --html-keep-comments --html-keep-conditional-comments --html-keep-default-attrvals --html-keep-document-tags --html-keep-end-tags --html-keep-quotes -r -o minified/ --match=\.html docs
Install Prettier with Node:
npm i -g prettier
Prettier defaults for HTML are fine, so you don't need to specify rules. Then run it on a specific file:
npx prettier -w <filename>
Ideally, run a minifier on the file once you're done with the work.