Skip to content

Point index.html symlink at recent.html by basename (#54)#70

Merged
jmacdotorg merged 2 commits into
masterfrom
fix/54-index-symlink
Jun 22, 2026
Merged

Point index.html symlink at recent.html by basename (#54)#70
jmacdotorg merged 2 commits into
masterfrom
fix/54-index-symlink

Conversation

@jmacdotorg

Copy link
Copy Markdown
Owner

Closes #54.

Diagnosis

publish_recent_page created the docroot/index.html symlink with recent_file's full path as the target:

symlink $self->recent_file, $temp_link

When the blog's docroot is named by a relative path, recent_file stringifies to something like docroot/recent.html. Since the symlink lives inside docroot, that target resolves to docroot/docroot/recent.html — so index.html dangles. (This is exactly what the reporter saw: index.html -> docroot/recent.html.) Even with an absolute path the link technically resolved but was non-portable — it broke if the published tree was moved or served from a different mount.

Fix

index.html sits right beside recent.html in the docroot, so link to it by basename:

symlink $self->recent_file->basename, $temp_link

A relative sibling target is correct whether the docroot is configured with an absolute or relative path, and survives the whole tree being relocated.

Test

Adds t/index_symlink.t: after publishing, asserts docroot/index.html is a symlink, that readlink returns exactly recent.html, and that it resolves to an existing file. The readlink assertion failed before the fix (the target was the full path); all pass now. Also verified end-to-end against the reporter's relative-path scenario. Full suite green (81 tests).

🤖 Generated with Claude Code

jmacdotorg and others added 2 commits June 21, 2026 20:09
The docroot/index.html symlink was created with recent_file's full path
as its target. When the docroot was named by a relative path, that target
("docroot/recent.html") resolved to docroot/docroot/recent.html from
inside the docroot, leaving index.html dangling. Even with an absolute
path the link was non-portable, breaking if the tree moved.

index.html sits beside recent.html in the docroot, so link to it by
basename. The relative sibling target is correct for absolute and
relative configs alike and survives the tree being moved.

Adds t/index_symlink.t asserting the link targets "recent.html" and
resolves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Per review, remove the three-line comment added above the symlink call.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jmacdotorg jmacdotorg merged commit 37a0eed into master Jun 22, 2026
3 checks passed
@jmacdotorg jmacdotorg deleted the fix/54-index-symlink branch June 22, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

index.html symlink broken

1 participant