fix: Replace hardcoded paths with route/url helpers for subdirectory support

Files updated:
- layouts/knowledge-base.blade.php - Use url('/') for home link
- layouts/navigation.blade.php - Use url('/') for nav links
- layouts/guest.blade.php - Use url('/') for logo link
- Document.php - Use route() for wiki links
- DocumentLink.php - Use route() for URL attribute
- AuthenticatedSessionController.php - Use url('/') for redirects
- DocumentEditor.php - Use url('/') for redirect
- ProfileController.php - Use url('/') for redirect

This ensures the app works when deployed in a subdirectory
This commit is contained in:
2025-11-29 17:14:46 +09:00
parent 25613eea05
commit 893d3c7a69
9 changed files with 18 additions and 12 deletions

View File

@@ -154,9 +154,9 @@ function ($matches) {
->first();
if ($targetDocument) {
return '<a href="/documents/' . $targetDocument->slug . '" class="wiki-link">' . e($linkTitle) . '</a>';
return '<a href="' . route('documents.show', $targetDocument->slug) . '" class="wiki-link">' . e($linkTitle) . '</a>';
} else {
return '<a href="/documents/create?title=' . urlencode($linkTitle) . '" class="wiki-link wiki-link-new">' . e($linkTitle) . '</a>';
return '<a href="' . route('documents.create') . '?title=' . urlencode($linkTitle) . '" class="wiki-link wiki-link-new">' . e($linkTitle) . '</a>';
}
},
$this->rendered_html

View File

@@ -57,9 +57,9 @@ public function isBroken(): bool
public function getUrlAttribute(): string
{
if ($this->isBroken()) {
return '/documents/create?title=' . urlencode($this->target_title);
return route('documents.create') . '?title=' . urlencode($this->target_title);
}
return '/documents/' . $this->targetDocument->slug;
return route('documents.show', $this->targetDocument->slug);
}
}