diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index 526d290d..00000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: GitHub Pages - -on: - push: - branches: - - master - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@master - with: - fetch-depth: 1 - lfs: false - - # Pull from custom Hugo Extended image with opinionated changes: - # https://github.com/jakejarvis/hugo-custom/packages - # https://github.com/jakejarvis/hugo-custom/blob/master/Dockerfile - # Can't use native `uses: docker://` syntax for GitHub Package Registry... - - name: Build Hugo - run: | - echo ${{ secrets.GITHUB_ACCESS_TOKEN }} | docker login docker.pkg.github.com -u $GITHUB_ACTOR --password-stdin - docker run -v $GITHUB_WORKSPACE:/src docker.pkg.github.com/jakejarvis/hugo-custom/hugo-custom:latest --gc --cleanDestinationDir --verbose - docker logout docker.pkg.github.com - - # Copy built site to a directory where we have permissions, and - # add a CNAME file for a custom domain (jarv.is). - - name: Prepare for GitHub Pages - run: | - cp -r $GITHUB_WORKSPACE/public $HOME/gh-pages - echo "jarv.is" > $HOME/gh-pages/CNAME - - # Put a bow on top of Hugo's automatic image processing by using - # pngquant and jpegoptim to optimize/compress images in posts, - # just a little lossily (is that a word?) - # - # TODO: Find a way to cache the results, this takes about 4 minutes - # each build -- not ideal. Maybe use @sindresorhus/imagemin. - - name: Optimize processed images - run: | - sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends jpegoptim pngquant optipng - cd $HOME/gh-pages/notes - find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --max=80 --strip-all - find . -iname "*.png" -print0 | xargs -0 pngquant --quality=50-70 --speed 3 --ext=.png --force - find . -iname "*.png" -print0 | xargs -0 optipng -o3 -force -strip all -quiet -- - # Ignore errors - override pipefail - shell: bash {0} - - # Initialize a sub-repository in the new gh-pages directory and - # add jakejarvis/jakejarvis.github.io as a remote. - # Using native git commands for speed and simplicity, and because - # this setup is a weird edge case not worth making an action for. - - name: Deploy to jakejarvis.github.io - run: | - cd $HOME/gh-pages - git init - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - git remote add origin https://${{ secrets.GITHUB_ACCESS_TOKEN }}@github.com/jakejarvis/jakejarvis.github.io.git - git add -A - git commit -m "GitHub Pages deploy from $GITHUB_REPOSITORY@$GITHUB_SHA" - git push --force origin master diff --git a/README.md b/README.md index f4fb815c..0ca34dae 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ # 🏡 [jarv.is](https://jarv.is/) -[](.github/workflows) [](https://github.com/jakejarvis/jarv.is) [](LICENSE.md) +[](https://app.netlify.com/sites/jakejarvis/deploys) [](https://github.com/jakejarvis/jarv.is) [](LICENSE.md) Personal website of [@jakejarvis](https://github.com/jakejarvis), created and deployed using the following: - [Hugo extended](https://github.com/gohugoio/hugo) -- [GitHub Pages](https://pages.github.com/) -- [GitHub Actions](.github/workflows) +- [Netlify](https://www.netlify.com/) - [Commento](https://gitlab.com/commento/commento) I keep an ongoing list of [blog post ideas](https://github.com/jakejarvis/jarv.is/issues/1) as an issue in this repo. diff --git a/config.toml b/config.toml index 7e240930..8007e992 100644 --- a/config.toml +++ b/config.toml @@ -16,6 +16,9 @@ pygmentsCodeFences = true enableRobotsTXT = true +# prefer Netlify's _redirects file, see outputs below +disableAliases = true + [author] name = "Jake Jarvis" email = "jake@jarv.is" @@ -32,9 +35,25 @@ enableRobotsTXT = true copyrightFirstYear = "2001" [outputs] - home = ["HTML", "RSS"] + home = ["HTML", "RSS", "REDIRECTS", "HEADERS"] section = ["HTML"] +[mediaTypes] + [mediaTypes."text/netlify"] + delimiter = "" + +[outputFormats] + [outputFormats.REDIRECTS] + mediatype = "text/netlify" + baseName = "_redirects" + isPlainText = true + notAlternative = true + [outputFormats.HEADERS] + mediatype = "text/netlify" + baseName = "_headers" + isPlainText = true + notAlternative = true + [sitemap] filename = "sitemap.xml" diff --git a/content/_index.html b/content/_index.html index 57f2793b..06520391 100644 --- a/content/_index.html +++ b/content/_index.html @@ -1,6 +1,6 @@ --- title: "Jake Jarvis – Front-End Web Developer in Boston, MA" -date: 2019-10-26 18:04:05-0400 +date: 2019-11-09 16:26:21-0400 description: "Hello! I'm a frontend web developer based in Boston, Massachusetts specializing in modern JavaScript frameworks and progressive web apps." type: home --- @@ -13,7 +13,7 @@ type: home
My recent focus has been on modern JavaScript frameworks like React, Angular, and Vue in front of Node and Go backends...
...but I'm fluent in classics like PHP, Ruby, Java, C++, and Python as well.
Whenever possible, I also prioritize my experience with information security, server(less) architecture, efficient DevOps & CI, and the containerization of everything.
-I fell in love with frontend web design and backend programming when my only source of income was the Tooth Fairy. (I've improved a little bit since those projects, I promise...)
+I fell in love with frontend web design and backend programming when my only source of income was the Tooth Fairy. (I've improved a little bit since those projects, I promise...)
Since then, my side projects have been diff --git a/content/humans.txt b/content/humans.txt index 3a0777c1..f9a73343 100644 --- a/content/humans.txt +++ b/content/humans.txt @@ -30,8 +30,7 @@ # TECHNOLOGY Hugo extended - GitHub Pages - GitHub Actions + Netlify Commento # VIEW SOURCE diff --git a/layouts/index.headers b/layouts/index.headers new file mode 100644 index 00000000..62281a87 --- /dev/null +++ b/layouts/index.headers @@ -0,0 +1,7 @@ +# Smart security headers + +/* + X-Frame-Options: sameorigin + X-XSS-Protection: 1; mode=block + Referrer-Policy: no-referrer + X-Content-Type-Options: nosniff diff --git a/layouts/index.redirects b/layouts/index.redirects new file mode 100644 index 00000000..1f697587 --- /dev/null +++ b/layouts/index.redirects @@ -0,0 +1,8 @@ +# Prefer Netlify redirects over Hugo aliases +# https://www.netlify.com/docs/redirects/ + +{{ range $p := .Site.Pages -}} +{{ range .Aliases }} +{{- . | printf "%-35s" }} {{ $p.RelPermalink }} +{{ end -}} +{{- end -}} diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 00000000..7945915e --- /dev/null +++ b/netlify.toml @@ -0,0 +1,41 @@ +# netlify.sh downloads my custom Hugo fork and builds the site independently. +[build] + command = "./scripts/netlify.sh" + publish = "public" + + +# The most important headers and redirects are specified in the _headers and +# _redirects files generated by Hugo. These are additional custom redirects. + +# Redirect default Netlify subdomain to primary domain: +[[redirects]] + from = "https://jakejarvis.netlify.com/*" + to = "https://jarv.is/:splat" + status = 301 + force = true + +# Support ancient RSS subscriptions from WordPress era: +[[redirects]] + from = "/feed" + to = "/index.xml" +[[redirects]] + from = "/rss" + to = "/index.xml" + +# Moved Y2K site to its own subdomain: +[[redirects]] + from = "/y2k/*" + to = "https://y2k.jarv.is/:splat" + status = 302 + +# Redirect iOS tracker files to their repo's GitHub Pages: +[[redirects]] + from = "/ios-trackers/*" + to = "https://jakejarvis.github.io/ios-trackers/:splat" + status = 200 + +# H A C K E R M A N +[[redirects]] + from = "/wp-login.php" + to = "https://giphy.com/embed/RyXVu4ZW454IM" + status = 302 diff --git a/scripts/docker-build.sh b/scripts/docker-build.sh new file mode 100755 index 00000000..96e19f41 --- /dev/null +++ b/scripts/docker-build.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# Make sure run from parent directory... + +echo "Building Hugo from Docker image..." +docker run -v $(pwd):/src jakejarvis/hugo-custom:latest --gc --cleanDestinationDir --verbose diff --git a/scripts/docker-server.sh b/scripts/docker-server.sh new file mode 100755 index 00000000..6f0c1a68 --- /dev/null +++ b/scripts/docker-server.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Make sure run from parent directory... + +echo "Building Docker image..." +docker build -t jarv.is:develop -f Dockerfile . + +echo "Starting live Hugo server..." +echo "Will go live at: http://localhost:1313" +docker run -v $(pwd):/src -p 1313:1313 jarv.is:develop diff --git a/scripts/netlify.sh b/scripts/netlify.sh new file mode 100755 index 00000000..7fe37901 --- /dev/null +++ b/scripts/netlify.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# only designed to run on Netlify's build image: +# https://github.com/netlify/build-image + +set -euo pipefail + +BINDIR=$HOME/jj-bin +mkdir -p $BINDIR + +# download forked Hugo extended binary +# https://github.com/jakejarvis/hugo-custom/releases +echo "Downloading Hugo..." +curl -sS -L https://github.com/jakejarvis/hugo-custom/releases/download/v0.53-patch3/hugo-extended -o $BINDIR/hugo-extended +chmod +x $BINDIR/hugo-extended + +# download jpegoptim binary +echo "Downloading jpegoptim..." +curl -sS -L https://github.com/imagemin/jpegoptim-bin/raw/master/vendor/linux/jpegoptim -o $BINDIR/jpegoptim +chmod +x $BINDIR/jpegoptim + +# download pngquant binary +echo "Downloading pngquant..." +curl -sS -L https://github.com/imagemin/pngquant-bin/raw/master/vendor/linux/x64/pngquant -o $BINDIR/pngquant +chmod +x $BINDIR/pngquant + +# download optipng binary +echo "Downloading optipng..." +curl -sS -L https://github.com/imagemin/optipng-bin/raw/master/vendor/linux/x64/optipng -o $BINDIR/optipng +chmod +x $BINDIR/optipng + +# make sure everything's OK +echo "Is Hugo ready..?" +$BINDIR/hugo-extended version + +# build Hugo site +echo "Building site..." +$BINDIR/hugo-extended --gc --cleanDestinationDir --verbose + +# optimize images in publish directory +echo "Optimizing JPEGs..." +find ./public -iname "*.jp*" -print0 | xargs -0 $BINDIR/jpegoptim --max=80 --strip-all --quiet +echo "Optimizing PNGs..." +find ./public -iname "*.png" -print0 | xargs -0 $BINDIR/pngquant --quality=50-70 --speed 3 --ext=.png --force +find ./public -iname "*.png" -print0 | xargs -0 $BINDIR/optipng -o3 -force -strip all -quiet -- + +# remove binaries (kinda unsafe, but doesn't really matter b/c it's docker) +echo "Cleaning up binaries..." +rm -rf $BINDIR + +echo "All done!" +exit 0