mirror of
https://github.com/samber/awesome-prometheus-alerts.git
synced 2026-06-25 02:46:59 +08:00
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.
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { defineConfig } from 'astro/config';
|
|
import tailwind from '@astrojs/tailwind';
|
|
import sitemap from '@astrojs/sitemap';
|
|
import icon from 'astro-icon';
|
|
import { parse as parseYaml } from 'yaml';
|
|
import { readFileSync } from 'fs';
|
|
import { resolve } from 'path';
|
|
|
|
/** Custom Vite plugin that parses YAML files using the 'yaml' package,
|
|
* which tolerates duplicate keys (last one wins) unlike js-yaml 4.x. */
|
|
function yamlPlugin() {
|
|
return {
|
|
name: 'vite-plugin-yaml-tolerant',
|
|
transform(code, id) {
|
|
if (!id.endsWith('.yml') && !id.endsWith('.yaml')) return null;
|
|
const content = readFileSync(resolve(id), 'utf-8');
|
|
const data = parseYaml(content, { merge: true, strict: false, uniqueKeys: false });
|
|
return {
|
|
code: `export default ${JSON.stringify(data)};`,
|
|
map: null,
|
|
};
|
|
},
|
|
};
|
|
}
|
|
|
|
export default defineConfig({
|
|
site: 'https://samber.github.io',
|
|
base: '/awesome-prometheus-alerts',
|
|
output: 'static',
|
|
integrations: [
|
|
tailwind({ applyBaseStyles: false }),
|
|
sitemap(),
|
|
icon(),
|
|
],
|
|
vite: {
|
|
plugins: [yamlPlugin()],
|
|
assetsInclude: ['**/*.yml'],
|
|
},
|
|
});
|