mirror of
https://github.com/samber/awesome-prometheus-alerts.git
synced 2026-06-23 09:58:16 +08:00
fix: remove dead legacyHtmlRedirects and clean up sitemap/SEO config
- Drop legacyHtmlRedirects from astro.config.mjs (no-op on static GitHub Pages host; superseded by *.html.astro pages from e0311c3)
- Remove lastmod: new Date() from sitemap serializer (generates unstable dates on every build)
- Add sitemap .html filter comment, tighten service page meta description, include rule count in titles
This commit is contained in:
parent
e0311c3c09
commit
eccf556bdb
3 changed files with 18 additions and 15 deletions
|
|
@ -67,10 +67,15 @@ const base = '/awesome-prometheus-alerts';
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://samber.github.io',
|
site: 'https://samber.github.io',
|
||||||
base,
|
base,
|
||||||
redirects: buildRedirects(base),
|
redirects: { ...buildRedirects(base) },
|
||||||
output: 'static',
|
output: 'static',
|
||||||
integrations: [
|
integrations: [
|
||||||
sitemap({
|
sitemap({
|
||||||
|
/** Exclude redirect source URLs from the sitemap.
|
||||||
|
* Astro generates static HTML redirect files for every entry in `redirects`, and the
|
||||||
|
* sitemap plugin naively picks them up. We must explicitly filter them out so that Google
|
||||||
|
* only indexes canonical destinations, not the redirect intermediaries. */
|
||||||
|
filter: (page) => !page.includes('.html'),
|
||||||
serialize(item) {
|
serialize(item) {
|
||||||
const path = new URL(item.url).pathname;
|
const path = new URL(item.url).pathname;
|
||||||
const segments = path.replace(/^\/|\/$/g, '').split('/').filter(Boolean);
|
const segments = path.replace(/^\/|\/$/g, '').split('/').filter(Boolean);
|
||||||
|
|
@ -78,22 +83,22 @@ export default defineConfig({
|
||||||
|
|
||||||
if (segments.length <= 1) {
|
if (segments.length <= 1) {
|
||||||
// Homepage
|
// Homepage
|
||||||
return { ...item, changefreq: 'weekly', priority: 1.0, lastmod: new Date() };
|
return { ...item, changefreq: 'weekly', priority: 1.0 };
|
||||||
}
|
}
|
||||||
if (segments.length === 2 && segments[1] === 'rules') {
|
if (segments.length === 2 && segments[1] === 'rules') {
|
||||||
// /rules/ index
|
// /rules/ index
|
||||||
return { ...item, changefreq: 'weekly', priority: 0.9, lastmod: new Date() };
|
return { ...item, changefreq: 'weekly', priority: 0.9 };
|
||||||
}
|
}
|
||||||
if (segments.length === 3 && segments[1] === 'rules') {
|
if (segments.length === 3 && segments[1] === 'rules') {
|
||||||
// /rules/[group]/ index
|
// /rules/[group]/ index
|
||||||
return { ...item, changefreq: 'monthly', priority: 0.7, lastmod: new Date() };
|
return { ...item, changefreq: 'monthly', priority: 0.7 };
|
||||||
}
|
}
|
||||||
if (segments.length === 4 && segments[1] === 'rules') {
|
if (segments.length === 4 && segments[1] === 'rules') {
|
||||||
// /rules/[group]/[service]/ — main content pages
|
// /rules/[group]/[service]/ — main content pages
|
||||||
return { ...item, changefreq: 'monthly', priority: 0.8, lastmod: new Date() };
|
return { ...item, changefreq: 'monthly', priority: 0.8 };
|
||||||
}
|
}
|
||||||
// Guide pages and others
|
// Guide pages and others
|
||||||
return { ...item, changefreq: 'yearly', priority: 0.6, lastmod: new Date() };
|
return { ...item, changefreq: 'yearly', priority: 0.6 };
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
icon(),
|
icon(),
|
||||||
|
|
|
||||||
|
|
@ -22,12 +22,10 @@ const ruleCount = getRuleCount(service);
|
||||||
const groupIndex = data.groups.findIndex((g) => getGroupSlug(g) === groupSlug) + 1;
|
const groupIndex = data.groups.findIndex((g) => getGroupSlug(g) === groupSlug) + 1;
|
||||||
const serviceIndex = group.services.findIndex((s) => getServiceSlug(s) === serviceSlug) + 1;
|
const serviceIndex = group.services.findIndex((s) => getServiceSlug(s) === serviceSlug) + 1;
|
||||||
|
|
||||||
// Build exporters summary for meta description
|
// Build exporters summary for keywords (kept for <meta keywords> but removed from description)
|
||||||
const exporterNames = service.exporters.map((e) => e.name).filter(Boolean).join(', ');
|
const exporterNames = service.exporters.map((e) => e.name).filter(Boolean).join(', ');
|
||||||
const metaDescBase = `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}${exporterNames ? ` (${exporterNames})` : ''}. Copy-paste YAML for critical and warning alerts.`;
|
// Description: lead with count + service + format signals. Exporter names go in keywords, not here.
|
||||||
const metaDesc = metaDescBase.length > 160
|
const metaDesc = `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}. Critical and warning YAML snippets — copy-paste into your Prometheus config or wget download.`;
|
||||||
? `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}. Copy-paste YAML for critical and warning alerts.`
|
|
||||||
: metaDescBase;
|
|
||||||
|
|
||||||
// FAQ JSON-LD for GEO (AI search engines)
|
// FAQ JSON-LD for GEO (AI search engines)
|
||||||
const faqItems = service.exporters.flatMap((exp) =>
|
const faqItems = service.exporters.flatMap((exp) =>
|
||||||
|
|
@ -55,7 +53,7 @@ const jsonLd = {
|
||||||
{
|
{
|
||||||
'@type': 'TechArticle',
|
'@type': 'TechArticle',
|
||||||
'@id': `${pageUrl}#article`,
|
'@id': `${pageUrl}#article`,
|
||||||
headline: `${service.name} Prometheus Alert Rules`,
|
headline: `${service.name} Prometheus Alert Rules (${ruleCount})`,
|
||||||
description: metaDesc,
|
description: metaDesc,
|
||||||
about: `Prometheus monitoring for ${service.name}`,
|
about: `Prometheus monitoring for ${service.name}`,
|
||||||
url: pageUrl,
|
url: pageUrl,
|
||||||
|
|
@ -76,7 +74,7 @@ const jsonLd = {
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<BaseLayout
|
||||||
title={`${service.name} Alert Rules | Awesome Prometheus Alerts`}
|
title={`${service.name} Prometheus Alert Rules (${ruleCount}) | Awesome Prometheus Alerts`}
|
||||||
description={metaDesc}
|
description={metaDesc}
|
||||||
ogType="article"
|
ogType="article"
|
||||||
keywords={keywords}
|
keywords={keywords}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ const redirectMap = buildRedirectMap(base);
|
||||||
const jsonLd = {
|
const jsonLd = {
|
||||||
'@context': 'https://schema.org',
|
'@context': 'https://schema.org',
|
||||||
'@type': 'CollectionPage',
|
'@type': 'CollectionPage',
|
||||||
name: 'Prometheus Alerting Rules',
|
name: `${totalRules} Prometheus Alerting Rules for ${totalServices} Services`,
|
||||||
description: `Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`,
|
description: `Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`,
|
||||||
url: `${SITE_URL}rules/`,
|
url: `${SITE_URL}rules/`,
|
||||||
isPartOf: schemaWebSite,
|
isPartOf: schemaWebSite,
|
||||||
|
|
@ -32,7 +32,7 @@ const jsonLd = {
|
||||||
---
|
---
|
||||||
|
|
||||||
<BaseLayout
|
<BaseLayout
|
||||||
title="Prometheus Alerting Rules | Awesome Prometheus Alerts"
|
title={`${totalRules} Prometheus Alerting Rules for ${totalServices} Services | Awesome Prometheus Alerts`}
|
||||||
description={`Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`}
|
description={`Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`}
|
||||||
jsonLd={jsonLd}
|
jsonLd={jsonLd}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue