- Add internal/views/ package with embedded templates and static files - Go html/template with SearXNG-compatible CSS class names - Dark mode via prefers-color-scheme, responsive layout, print styles - HTMX integration: - Debounced instant search (500ms) on the search input - Form submission targets #results via hx-post - Pagination buttons are HTMX-powered (swap results div only) - HX-Request header detection for fragment vs full page rendering - Template structure: - base.html: full page layout with HTMX script, favicon, CSS - index.html: homepage with centered search box - results.html: full results page (wraps base + results_inner) - results_inner.html: results fragment (HTMX partial + sidebar + pagination) - result_item.html: reusable result article partial - Smart format detection: browser requests (Accept: text/html) default to HTML, API clients default to JSON - Static files served at /static/ from embedded FS (CSS, favicon SVG) - Index route at GET / - Empty query on HTML format redirects to homepage - Custom CSS (gosearch.css): clean, minimal, privacy-respecting aesthetic with light/dark mode, responsive breakpoints, print stylesheet - Add views package tests
25 lines
983 B
HTML
25 lines
983 B
HTML
{{define "base"}}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="referrer" content="no-referrer">
|
|
<meta name="robots" content="noarchive">
|
|
<meta name="description" content="gosearch — a privacy-respecting, open metasearch engine">
|
|
<title>{{template "title" .}}gosearch</title>
|
|
<link rel="stylesheet" href="/static/css/gosearch.css">
|
|
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
|
|
<link rel="icon" href="/static/img/favicon.svg" type="image/svg+xml">
|
|
<link title="gosearch" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml">
|
|
</head>
|
|
<body class="{{if .Query}}search_on_results{{end}}">
|
|
<main>
|
|
{{template "content" .}}
|
|
</main>
|
|
<footer>
|
|
<p>Powered by <a href="https://git.ashisgreat.xyz/penal-colony/gosearch">gosearch</a> — a privacy-respecting, open metasearch engine</p>
|
|
</footer>
|
|
</body>
|
|
</html>
|
|
{{end}}
|