about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-05-24 03:45:11 +0200
committerRobert Günzler <r@gnzler.io>2025-05-24 04:14:44 +0200
commit52b4f046918e7ccbb114762f3f58302c59d9e2a2 (patch)
tree60aec59d3967875265c02fdd6b9bda86afcb136d
parent548087f008424585f850cad6607b87a1f6bef822 (diff)
downloadsite-52b4f046918e7ccbb114762f3f58302c59d9e2a2.tar.gz
add webarchive links to like page
Signed-off-by: Robert Günzler <r@gnzler.io>
-rw-r--r--site/.index.html0
-rw-r--r--site/index.html2
-rw-r--r--site/like.html24
-rw-r--r--src/inc/index.htm1
-rw-r--r--src/inc/like.htm22
-rw-r--r--src/inc/like.md10
-rw-r--r--src/main.zig46
7 files changed, 84 insertions, 21 deletions
diff --git a/site/.index.html b/site/.index.html
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/site/.index.html
diff --git a/site/index.html b/site/index.html
index 629121b..369abbf 100644
--- a/site/index.html
+++ b/site/index.html
@@ -59,7 +59,7 @@
 </ul>
 </main>
 <footer>
-Edited on 2025-05-22 <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/index.htm" target="_blank">[src]</a>
+Edited on 2025-05-24 <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/index.htm" target="_blank">[src]</a>
 <a href="mailto:~robertgzr/public-inbox@lists.sr.ht">[comments]</a>
 <br>
 <b>robertgzr</b>
diff --git a/site/like.html b/site/like.html
index 6193ed7..a1d498d 100644
--- a/site/like.html
+++ b/site/like.html
@@ -35,13 +35,21 @@
 <p>here’s some stuff i like:</p>
 <ul>
 <li><a href="https://tailscale.com/blog/plan9-port" class="uri"
-target="_blank">https://tailscale.com/blog/plan9-port</a></li>
+target="_blank">https://tailscale.com/blog/plan9-port</a> <a
+href="https://web.archive.org/web/20250403135024/https://tailscale.com/blog/plan9-port"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://anniemueller.com/posts/in-praise-of-creating-crap"
 class="uri"
-target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a></li>
+target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a>
+<a
+href="https://web.archive.org/web/20250524011520/https://anniemueller.com/posts/in-praise-of-creating-crap"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://www.math.uwaterloo.ca/tsp/korea/index.html"
 class="uri"
-target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a></li>
+target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a>
+<a
+href="https://web.archive.org/web/20250524011652/https://www.math.uwaterloo.ca/tsp/korea/index.html"
+target="_blank"><sup>[?]</sup></a></li>
 </ul>
 <blockquote>
 <p>It’s not that user experience designers are trying to kill curiosity.
@@ -49,13 +57,15 @@ They’re trying to help. But help, at scale, becomes architecture. And
 architecture shapes cognition. The interfaces we use become metaphors
 for how we think the world works. If your phone always gives you the
 answer, you stop asking better questions.<br />
-<a href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
-style="float:right"
-target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a></p>
+<span class="float-r"><a
+href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
+class="uri"
+target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a>
+<a href="" target="_blank"><sup>[?]</sup></a></span></p>
 </blockquote>
 </main>
 <footer>
-Edited on 2025-05-22 <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/like.htm" target="_blank">[src]</a>
+Edited on 2025-05-24 <a href="https://git.sr.ht/~robertgzr/site/tree/master/src/inc/like.htm" target="_blank">[src]</a>
 <a href="mailto:~robertgzr/public-inbox@lists.sr.ht">[comments]</a>
 <br>
 <b>robertgzr</b>
diff --git a/src/inc/index.htm b/src/inc/index.htm
index fdd90d9..3778d31 100644
--- a/src/inc/index.htm
+++ b/src/inc/index.htm
@@ -1,4 +1,5 @@
 <ul class="col2 captial">
+<li><a href="/site/.index.html">.index</a></li>
 <li><a href="/site/2025.html">2025</a></li>
 <li><a href="/site/404.html">404</a></li>
 <li><a href="/site/about.html">about</a></li>
diff --git a/src/inc/like.htm b/src/inc/like.htm
index 6bc88cb..74fb67d 100644
--- a/src/inc/like.htm
+++ b/src/inc/like.htm
@@ -2,13 +2,21 @@
 <p>here’s some stuff i like:</p>
 <ul>
 <li><a href="https://tailscale.com/blog/plan9-port" class="uri"
-target="_blank">https://tailscale.com/blog/plan9-port</a></li>
+target="_blank">https://tailscale.com/blog/plan9-port</a> <a
+href="https://web.archive.org/web/20250403135024/https://tailscale.com/blog/plan9-port"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://anniemueller.com/posts/in-praise-of-creating-crap"
 class="uri"
-target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a></li>
+target="_blank">https://anniemueller.com/posts/in-praise-of-creating-crap</a>
+<a
+href="https://web.archive.org/web/20250524011520/https://anniemueller.com/posts/in-praise-of-creating-crap"
+target="_blank"><sup>[?]</sup></a></li>
 <li><a href="https://www.math.uwaterloo.ca/tsp/korea/index.html"
 class="uri"
-target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a></li>
+target="_blank">https://www.math.uwaterloo.ca/tsp/korea/index.html</a>
+<a
+href="https://web.archive.org/web/20250524011652/https://www.math.uwaterloo.ca/tsp/korea/index.html"
+target="_blank"><sup>[?]</sup></a></li>
 </ul>
 <blockquote>
 <p>It’s not that user experience designers are trying to kill curiosity.
@@ -16,7 +24,9 @@ They’re trying to help. But help, at scale, becomes architecture. And
 architecture shapes cognition. The interfaces we use become metaphors
 for how we think the world works. If your phone always gives you the
 answer, you stop asking better questions.<br />
-<a href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
-style="float:right"
-target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a></p>
+<span class="float-r"><a
+href="https://www.joanwestenberg.com/how-convenience-kills-curiosity"
+class="uri"
+target="_blank">https://www.joanwestenberg.com/how-convenience-kills-curiosity</a>
+<a href="" target="_blank"><sup>[?]</sup></a></span></p>
 </blockquote>
diff --git a/src/inc/like.md b/src/inc/like.md
index f69feb7..1b88327 100644
--- a/src/inc/like.md
+++ b/src/inc/like.md
@@ -1,12 +1,14 @@
 here's some stuff i like:
 
-- https://tailscale.com/blog/plan9-port
-- https://anniemueller.com/posts/in-praise-of-creating-crap
-- https://www.math.uwaterloo.ca/tsp/korea/index.html
+- https://tailscale.com/blog/plan9-port [^[?]^](https://web.archive.org/web/20250403135024/https://tailscale.com/blog/plan9-port)
+- https://anniemueller.com/posts/in-praise-of-creating-crap [^[?]^](https://web.archive.org/web/20250524011520/https://anniemueller.com/posts/in-praise-of-creating-crap)
+- https://www.math.uwaterloo.ca/tsp/korea/index.html [^[?]^](https://web.archive.org/web/20250524011652/https://www.math.uwaterloo.ca/tsp/korea/index.html)
 
 > It’s not that user experience designers are trying to kill curiosity. They’re
 > trying to help. But help, at scale, becomes architecture. And architecture
 > shapes cognition. The interfaces we use become metaphors for how we think the
 > world works. If your phone always gives you the answer, you stop asking
 > better questions.  
-<https://www.joanwestenberg.com/how-convenience-kills-curiosity>{style="float:right"}
+> <span class="float-r"><https://www.joanwestenberg.com/how-convenience-kills-curiosity> [^[?]^]()</span>
+
+
diff --git a/src/main.zig b/src/main.zig
index 64b76d9..e6ed977 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -364,14 +364,54 @@ fn genSite(ctx: *Context) !void {
     }
 }
 
+const FileSwapper = struct {
+    allocator: std.mem.Allocator,
+    target_path: []const u8,
+    tmp_path: []const u8,
+    tmp: std.fs.File,
+
+    fn createAt(allocator: std.mem.Allocator, path: []const u8) !FileSwapper {
+        const target_dir = std.fs.path.dirname(path) orelse ".";
+        const target_name = std.fs.path.basename(path);
+
+        const tmp_name = try std.fmt.allocPrint(allocator, ".{s}", .{target_name});
+        defer allocator.free(tmp_name);
+
+        const tmp_path = try std.fs.path.join(allocator, &.{ target_dir, tmp_name });
+
+        const f = try std.fs.cwd().createFile(tmp_path, .{});
+
+        return .{
+            .allocator = allocator,
+            .target_path = path,
+            .tmp_path = tmp_path,
+            .tmp = f,
+        };
+    }
+
+    fn writer(self: FileSwapper) std.fs.File.Writer {
+        return self.tmp.writer();
+    }
+
+    fn close(self: FileSwapper) void {
+        defer self.allocator.free(self.tmp_path);
+        defer self.tmp.close();
+
+        self.tmp.sync() catch @panic("sync tmp file");
+
+        std.debug.print("??? {s} => {s}\n", .{ self.tmp_path, self.target_path });
+        std.fs.rename(std.fs.cwd(), self.tmp_path, std.fs.cwd(), self.target_path) catch @panic("rename tmp file");
+    }
+};
+
 fn genIndexHtml(ctx: *Context) !void {
     const srcpathIndex = try joinIn(ctx.allocator, &.{PAGE_PATH}, &.{"index.htm"});
     defer ctx.allocator.free(srcpathIndex);
 
-    const f = try std.fs.cwd().createFile(srcpathIndex, .{});
+    const f = try FileSwapper.createAt(ctx.allocator, srcpathIndex);
     defer f.close();
 
-    try f.writeAll(
+    try f.writer().writeAll(
         \\<ul class="col2 captial">
         \\
     );
@@ -404,7 +444,7 @@ fn genIndexHtml(ctx: *Context) !void {
         });
     }
 
-    try f.writeAll(
+    try f.writer().writeAll(
         \\</ul>
         \\
     );