Hugo Tips
So, in trying to make it easier to get content shipped easier, I’ve been working to glue together several moving parts into a somewhat cohesive set of scaffolding to deploy a site like the one you’re interacting with.
The scaffold consists of several gitlab projects bringing the disparate pieces of
- Hugo
- TailwindCSS
- Congo
- GitLab-CI
- Docker
- Nginx
- our own tooling
On one hand, it’s pretty neat that it all fits together.
On the other, there’s quite a few moving pieces and sore spots.
I’ll be writing more over the coming time about how all these pieces fit together, as I also work to refine the scaffold itself… as mentioned elsewhere, this is really just the first functional amalgam of the pieces, and a lot of stuff isn’t quite fully functional yet… but hey… that’s what innovatitively aligned projects are all about, right?
This post in specific, however was intended to cover a post I found by The Tech Teapot1
He’s got a couple neat scripts on his Github project2 which look interesting:
CheckLinks #
#!/usr/bin/env bash
# Check all internal links on the dev site
# default port used when `hugo serve` command is used
SITE_URL="http://localhost:1313"
# Start the test server in daemon mode
# so as not to block the script
docker-compose up -d
# Wait for the test server to start up
until $(curl --output /dev/null --silent --head --fail $SITE_URL/); do
printf '.'
sleep 1
done
# To check external links add:
# --ignore-url=https://fonts.gstatic.com \
# --check-extern \
docker run --rm -it --network="host" -u $(id -u):$(id -g) \
ghcr.io/linkchecker/linkchecker:latest \
--ignore-url=/dist --no-status \
$SITE_URL/
docker-compose down
CheckSitemap #
#!/usr/bin/env bash
# Validate the contents of the sitemap
# See https://blog.atj.me/2018/05/crawl-sitemap-xml-with-curl/ for inspiration
SITEMAP_URI="/sitemap.xml"
SITEMAP_URL="http://localhost:1313"$SITEMAP_URI
# Start the test server
docker-compose up -d
# Wait for the test server to start up
until $(curl --output /dev/null --silent --head --fail $SITEMAP_URL); do
printf '.'
sleep 1
done
curl -s $SITEMAP_URL | \
grep -e loc | \
sed 's|<loc>\(.*\)<\/loc>$|\1|g' | \
xargs -I {} curl -s -o /dev/null -w "%{http_code} %{url_effective}\n" {} | \
grep -v ^200
docker-compose down
Will have to check these out more later!