From 2be3dd608a32e0ccd3b39639e14c10f74cb726a4 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Thu, 12 Oct 2023 18:43:18 -0400
Subject: [PATCH] A crazy hack attempt at rewriting index.html....

---
 clean-build.sh            |  4 ++++
 config/_default/hugo.toml | 14 +++++++++++++-
 package.json              |  5 ++++-
 vercel.json               | 33 ++++++++++++++++++++++-----------
 4 files changed, 43 insertions(+), 13 deletions(-)
 create mode 100755 clean-build.sh

diff --git a/clean-build.sh b/clean-build.sh
new file mode 100755
index 000000000..43733492e
--- /dev/null
+++ b/clean-build.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+find public/news -name "index.html" -exec rename --all "index.html" "status.html" {} \;
+find public/projects -name "index.html" -exec rename --all "index.html" "status.html" {} \;
+find public/resource -name "index.html" -exec rename --all "index.html" "status.html" {} \;
diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml
index ba3f25d02..07ee29a1a 100644
--- a/config/_default/hugo.toml
+++ b/config/_default/hugo.toml
@@ -8,15 +8,21 @@ DefaultContentLanguage = "en"
 defaultContentLanguageInSubdir = false
 
 enableRobotsTXT = true
+uglyURLs=false
 
 [services.rss]
 limit = 50
 
 # [permalinks]
+# news = "/:section/:slug/"
+# projects = "/:section/:slug/"
+# resource = "/:section/:slug/"
+# '/' = "/:section/:slug/"
 # [permalinks.page]
 # news = "/:section/:slug/"
 # projects = "/:section/:slug/"
 # resource = "/:section/:slug/"
+# '/' = "/:section/:slug/"
 
 [taxonimies]
 tag = "tags"
@@ -44,8 +50,14 @@ notAlternative = true
 baseName = "manifest"
 [outputFormats.ACTIVITY_STATUS]
 mediaType = "application/activity+json"
-notAlternative = true
+notAlternative = false
 baseName = "status"
+#[outputFormats.HTML_STATUS]
+#mediaType = "text/html"
+#notAlternative = true
+#baseName = "index"
+#permalinkable=false
+#noUgly=true
 
 [outputs]
 home = ["HTML", "RSS", "ACTIVITY", "ACTIVITY_OUTBOX", "MANIFEST"]
diff --git a/package.json b/package.json
index f0d13c709..80968d921 100644
--- a/package.json
+++ b/package.json
@@ -28,5 +28,8 @@
     "@types/multiparty": "^0.0.34",
     "typescript": "^5.2.2"
   },
-  "type": "module"
+  "type": "module",
+  "scripts": {
+    "vercel-build": "sh clean-build.sh"
+  }
 }
diff --git a/vercel.json b/vercel.json
index ed8fd1b02..a32ad9d28 100644
--- a/vercel.json
+++ b/vercel.json
@@ -20,17 +20,6 @@
     }
   ],
   "rewrites": [
-    {
-      "source": "/news/(.*)/",
-      "has": [
-        {
-          "type": "header",
-          "key": "Accept",
-          "value": "application/activity+json"
-        }
-      ],
-      "destination": "/news/$1/status.ajson"
-    },
     {
       "source": "/(.+)/$",
       "destination": "/$1/index.html"
@@ -71,6 +60,28 @@
       "source": "/send-note",
       "destination": "/api/activitypub/sendNote.js"
     },
+    {
+      "source": "/:pathSection/:pathPage/",
+      "has": [
+        {
+          "type": "header",
+          "key": "Accept",
+          "value": "application/activity+json"
+        }
+      ],
+      "destination": "/:pathSection/pathPage/status.ajson"
+    },
+    {
+      "source": "/:pathSection/:pathPage/",
+      "missing": [
+        {
+          "type": "header",
+          "key": "Accept",
+          "value": "application/activity+json"
+        }
+      ],
+      "destination": "/:pathSection/pathPage/status.html"
+    },
     {
       "source": "/:pathSection/:pathPage/activity",
       "destination": "/:pathSection/:pathPage/activity.ajson"
-- 
GitLab