--- // Client-side search via Pagefind. The search box lives in the site header; // this component is mounted once per page (in BaseLayout) and drives the // overlay + results. Pagefind's index is generated post-build (see the build // script); its UI/JS loads from /pagefind/ at runtime. interface Props { lang: string; } const { lang } = Astro.props; const placeholder = lang === 'zh' ? '搜索文章…' : 'Search posts…'; const noResults = lang === 'zh' ? '没有匹配的结果。' : 'No results.'; // Empty-search state: a dead end helps nobody. Offer the topic entry points that // actually exist (tag pages are generated for tags with >= 3 posts). const popular = ['docker', 'self-hosting', 'nginx', 'monitoring', 'automation']; const popularHref = (t: string) => (lang === 'zh' ? `/zh/tags/${t}/` : `/tags/${t}/`); const tryLabel = lang === 'zh' ? '试试这些主题:' : 'Try a topic:'; const archiveLabel = lang === 'zh' ? '浏览全部文章' : 'Browse all posts'; const archiveHref = lang === 'zh' ? '/zh/posts/' : '/posts/'; ---