From 7ead1a03720a0391a1c2337013a7de65d341bff5 Mon Sep 17 00:00:00 2001
From: Chris Coley <chris@codingallnight.com>
Date: Sat, 15 Jun 2024 19:43:42 -0700
Subject: [PATCH] Document all the valid URLs for files and directories in
 GitLab Pages

---
 src/cache-test-symlink.html |  1 +
 src/cache-test.html         | 54 ++++++++++++++++++++++++++++++++-----
 2 files changed, 48 insertions(+), 7 deletions(-)
 create mode 120000 src/cache-test-symlink.html

diff --git a/src/cache-test-symlink.html b/src/cache-test-symlink.html
new file mode 120000
index 0000000..d8c61d5
--- /dev/null
+++ b/src/cache-test-symlink.html
@@ -0,0 +1 @@
+cache-test.html
\ No newline at end of file
diff --git a/src/cache-test.html b/src/cache-test.html
index 3b0a8d8..a60c97d 100644
--- a/src/cache-test.html
+++ b/src/cache-test.html
@@ -8,6 +8,16 @@
   <link rel="shortcut icon" href="gitlab-favicon.png">
   <link rel="preload" href="style.css" as="style">
   <link rel="stylesheet" href="style.css">
+  <style>
+    img {
+      float: left;
+      margin-right: 1em;
+    }
+
+    .clearfix {
+      clear: both;
+    }
+  </style>
 </head>
 <body>
   <header>
@@ -18,27 +28,57 @@
   </header>
   <main>
     <h1>Cache Test</h1>
-
+    <img src="gitlab-logo.png" alt="GitLab logo" width=200>
     <p>
       This page is meant for testing caching.
     </p>
     <p>
       It was built on the <strong>%%BRANCH%%</strong> branch of the
-      <a href="%%PROJECT_URL%%"><strong>%%PROJECT_PATH%%</strong></a> project.
+      <a href="%%PROJECT_URL%%"><strong>%%PROJECT_PATH%%</strong></a> project in
+      <a href="%%JOB_URL%%">Job %%JOB_ID%%</a> at %%JOB_TIMESTAMP%%.
     </p>
     <p>
-      The current site revision is <a href="%%PROJECT_URL%%/-/commit/%%COMMIT_SHA%%"><code>%%COMMIT_SHA%%</code></a> from %%COMMIT_TIMESTAMP%%.
+      The current site revision is
+      <a href="%%PROJECT_URL%%/-/commit/%%COMMIT_SHA%%"><code>%%COMMIT_SHA%%</code></a>
+      from %%COMMIT_TIMESTAMP%%.
     </p>
     <p>
-      It was built in <a href="%%JOB_URL%%">Job %%JOB_ID%%</a> at %%JOB_TIMESTAMP%%.
+      Here's a static CSS file: <a href="style.css">style.css</a>
     </p>
     <p>
-      Here's a CSS file: <a href="style.css">style.css</a>
+      Here's a static image: <a href="gitlab-logo.png">gitlab-logo.png</a>
     </p>
     <p>
-      Here's an image:
+      Here's a symlink to this same page: <a href="cache-test-symlink.html">cache-test-symlink.html</a>
     </p>
-    <img src="gitlab-logo.png" alt="GitLab logo" width=200>
+    <h2 class="clearfix">Path Fudging</h2>
+    <p>
+      The server for GitLab Pages does some path fudging to make user experience
+      better, but you have to make sure you account for that fudging when you
+      purge the cache by URLs. The fudging rules are:
+    </p>
+    <ul>
+      <li>Directories can be accessed with or without a trailing slash.</li>
+      <li>Files can be accessed with or without a trailing slash.</li>
+      <li>
+        Files with the <code>.html</code> extension can be accessed with or
+        without the file extension.
+      </li>
+    </ul>
+    <p>
+      So every HTML file has four URLs it can be accessed on, and every other
+      file and directory has two. Here are some examples:
+    </p>
+    <ul>
+      <li><a href="cache-test.html">cache-test.html</a>
+      <li><a href="cache-test">cache-test</a>
+      <li><a href="cache-test.html/">cache-test.html/</a>
+      <li><a href="cache-test/">cache-test/</a>
+      <li><a href="style.css">style.css</a>
+      <li><a href="style.css/">style.css/</a>
+      <li><a href="sub">sub</a>
+      <li><a href="sub/">sub/</a>
+    </ul>
   </main>
 </body>
 </html>
-- 
GitLab