errors.go
package content
import (
"html/template"
"github.com/readysite/readysite/website/internal/helpers"
"github.com/readysite/readysite/website/models"
)
// NotFound404HTML returns the HTML for a 404 error page.
func NotFound404HTML() string {
siteName := helpers.GetSetting(models.SettingSiteName)
if siteName == "" {
siteName = "My Website"
}
escapedName := template.HTMLEscapeString(siteName)
return `<!DOCTYPE html>
<html lang="en" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page Not Found - ` + escapedName + `</title>
<link href="https://cdn.jsdelivr.net/npm/daisyui@5" rel="stylesheet" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
</head>
<body class="min-h-screen bg-base-200">
<div class="navbar bg-base-100 shadow-lg">
<div class="flex-1">
<a href="/" class="btn btn-ghost text-xl">` + escapedName + `</a>
</div>
</div>
<main class="container mx-auto p-8">
<div class="card bg-base-100 shadow-xl">
<div class="card-body text-center">
<h1 class="text-6xl font-bold text-error">404</h1>
<h2 class="text-2xl font-semibold mt-4">Page Not Found</h2>
<p class="text-base-content/70 mt-2">The page you're looking for doesn't exist.</p>
<div class="card-actions justify-center mt-6">
<a href="/" class="btn btn-primary">Go Home</a>
</div>
</div>
</div>
</main>
</body>
</html>`
}