mirror of
https://github.com/samber/awesome-prometheus-alerts.git
synced 2026-06-20 16:46:37 +08:00
* feat: migrate website from Jekyll to Astro Rebuilds the site using Astro (SSG) with Tailwind CSS v4, replacing the Jekyll/Cayman theme. Key changes: - Splits the monolithic /rules page into 110 statically-generated pages (92 per-service + 13 group index + homepage + guide pages) for SEO - URL structure: /rules/[group-slug]/[service-slug]/ with backward- compatibility redirect map for old anchor-based URLs (/rules#redis) - Modern UI: Prometheus-orange accent, dark mode (system + toggle), sticky sidebar, responsive layout, copy-to-clipboard per rule/section - SEO: per-page <title>, <meta description>, Open Graph, Twitter Card, canonical URLs, sitemap.xml via @astrojs/sitemap - GEO: FAQPage JSON-LD schema on each service page (rules as Q&A pairs for AI search engines), TechArticle schema, BreadcrumbList - Search: Pagefind (build-time index, lazy-loaded, ~200KB) - Zero JS by default; copy buttons and theme toggle use inline scripts - New CI: .github/workflows/deploy.yml builds Astro + Pagefind and deploys to GitHub Pages via actions/deploy-pages - Existing dist.yml and test.yml workflows are untouched - _data/rules.yml remains the single source of truth Note: GitHub Pages source must be changed from "Build from branch" (Jekyll) to "GitHub Actions" in repository settings. * doc: new website based on astro * refactor: remove previous website * chore: add npm dependabot for Astro site + scope CI to _data changes * Update site/astro.config.mjs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update site/src/components/CopyButton.astro Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * oops * fix: strip trailing slash from BASE_URL to prevent double slashes in URLs Agent-Logs-Url: https://github.com/samber/awesome-prometheus-alerts/sessions/c85937ba-1855-4b8a-a72b-847eab1c8639 Co-authored-by: samber <2951285+samber@users.noreply.github.com> * fix: resolve Astro build errors in astro.config.mjs - Remove assetsInclude yml which caused Vite to treat YAML files as static assets instead of running them through the custom YAML transform plugin; data.groups was undefined at runtime because the import resolved to a URL rather than parsed content - Deduplicate old-path redirects: emit only the slash-less variant per service to avoid Astro router collision warnings (trailing-slash variant is handled automatically) --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: samber <2951285+samber@users.noreply.github.com>
72 lines
3 KiB
Text
72 lines
3 KiB
Text
---
|
|
import type { Group, Service } from '../data/rules';
|
|
import { getGroupSlug, getServiceSlug } from '../data/rules';
|
|
|
|
interface Props {
|
|
groups: Group[];
|
|
currentGroupSlug?: string;
|
|
currentServiceSlug?: string;
|
|
currentService?: Service;
|
|
base: string;
|
|
}
|
|
|
|
const { groups, currentGroupSlug, currentServiceSlug, currentService, base } = Astro.props;
|
|
---
|
|
|
|
<aside class="hidden lg:block w-60 flex-shrink-0" aria-label="Rules navigation">
|
|
<nav class="sticky top-20 max-h-[calc(100vh-6rem)] overflow-y-auto pr-2 pb-8">
|
|
<ul class="space-y-3">
|
|
{groups.map((group, i) => {
|
|
const groupSlug = getGroupSlug(group);
|
|
const isGroupActive = groupSlug === currentGroupSlug;
|
|
|
|
return (
|
|
<li class={i > 0 ? 'pt-3 border-t border-slate-100 dark:border-slate-800' : ''}>
|
|
<a
|
|
href={`${base}/rules/${groupSlug}/`}
|
|
class={`block text-xs font-bold uppercase tracking-widest mb-1.5 transition-colors ${isGroupActive ? 'text-brand dark:text-brand-dark' : 'text-slate-700 dark:text-slate-300 hover:text-brand dark:hover:text-brand-dark'}`}
|
|
>
|
|
{group.name}
|
|
</a>
|
|
<ul class="space-y-0.5">
|
|
{group.services.map((service) => {
|
|
const serviceSlug = getServiceSlug(service);
|
|
const isActive = isGroupActive && serviceSlug === currentServiceSlug;
|
|
return (
|
|
<li>
|
|
<a
|
|
href={`${base}/rules/${groupSlug}/${serviceSlug}/`}
|
|
class={`block text-sm py-0.5 px-2 rounded transition-colors truncate ${
|
|
isActive
|
|
? 'text-brand dark:text-brand-dark bg-brand/5 dark:bg-brand-dark/10 font-medium'
|
|
: 'text-slate-400 dark:text-slate-500 hover:text-slate-700 dark:hover:text-slate-300 hover:bg-slate-50 dark:hover:bg-slate-800/50'
|
|
}`}
|
|
>
|
|
{service.name}
|
|
</a>
|
|
|
|
{/* Exporter sub-level — only on the current service page */}
|
|
{isActive && currentService && currentService.exporters.length > 1 && (
|
|
<ul class="mt-0.5 ml-3 space-y-0.5 border-l border-slate-200 dark:border-slate-700 pl-2">
|
|
{currentService.exporters.map((exp) => (
|
|
<li>
|
|
<a
|
|
href={`#exporter-${exp.slug}`}
|
|
class="block text-xs py-0.5 px-1 rounded truncate text-slate-400 dark:text-slate-500 hover:text-slate-700 dark:hover:text-slate-300 transition-colors"
|
|
>
|
|
{exp.name ?? exp.slug}
|
|
</a>
|
|
</li>
|
|
))}
|
|
</ul>
|
|
)}
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
</li>
|
|
);
|
|
})}
|
|
</ul>
|
|
</nav>
|
|
</aside>
|