From 2a528e61f484200c6c483f321e2ab5016fc9cbfa Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sat, 15 Jun 2024 20:02:48 -0700
Subject: [PATCH] Include symlinks when purging URLs

---
 .gitlab-ci.yml | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 09addc1..c1402af 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -85,19 +85,15 @@ create-purge-json:
       # Add the index-less homepage, with and without trailing slash
       echo -en "\n    \"$CI_PAGES_URL\"" >> purge.json
       echo -en ",\n    \"$CI_PAGES_URL/\"" >> purge.json
-      # Add all the directories, with and without trailing slash
-      for d in $(find public/* -type d); do
-        echo -en ",\n    \"$CI_PAGES_URL/${d#public/}\"" >> purge.json
-        echo -en ",\n    \"$CI_PAGES_URL/${d#public/}/\"" >> purge.json
-      done
-      # Add all the non-HTML files, with and without trailing slash
-      for f in $(find public -type f -not -iname '*.html'); do
+      # Add all the directories, non-HTML files and non-HTML symlinks; with and
+      # without trailing slash
+      for f in $(find public \( -type d -or -type f -or -type l \) -not -iname '*.html'); do
         echo -en ",\n    \"$CI_PAGES_URL/${f#public/}\"" >> purge.json
         echo -en ",\n    \"$CI_PAGES_URL/${f#public/}/\"" >> purge.json
       done
-      # Add all the HTML files, with and without trailing slash. First with file
-      # extension, then without
-      for f in $(find public -type f -iname '*.html'); do
+      # Add all the HTML files and HTML symlinks, with and without trailing
+      # slash. First with file extension, then without
+      for f in $(find public \( -type f -or -type l \) -iname '*.html'); do
         echo -en ",\n    \"$CI_PAGES_URL/${f#public/}\"" >> purge.json
         echo -en ",\n    \"$CI_PAGES_URL/${f#public/}/\"" >> purge.json
         f="${f%.html}"
-- 
GitLab