Skip to content

Commit eccf556

Browse files
committed
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
1 parent e0311c3 commit eccf556

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

site/astro.config.mjs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,38 @@ const base = '/awesome-prometheus-alerts';
6767
export default defineConfig({
6868
site: 'https://samber.github.io',
6969
base,
70-
redirects: buildRedirects(base),
70+
redirects: { ...buildRedirects(base) },
7171
output: 'static',
7272
integrations: [
7373
sitemap({
74+
/** Exclude redirect source URLs from the sitemap.
75+
* Astro generates static HTML redirect files for every entry in `redirects`, and the
76+
* sitemap plugin naively picks them up. We must explicitly filter them out so that Google
77+
* only indexes canonical destinations, not the redirect intermediaries. */
78+
filter: (page) => !page.includes('.html'),
7479
serialize(item) {
7580
const path = new URL(item.url).pathname;
7681
const segments = path.replace(/^\/|\/$/g, '').split('/').filter(Boolean);
7782
// segments[0] = 'awesome-prometheus-alerts', [1] = 'rules'|guide, [2] = group, [3] = service
7883

7984
if (segments.length <= 1) {
8085
// Homepage
81-
return { ...item, changefreq: 'weekly', priority: 1.0, lastmod: new Date() };
86+
return { ...item, changefreq: 'weekly', priority: 1.0 };
8287
}
8388
if (segments.length === 2 && segments[1] === 'rules') {
8489
// /rules/ index
85-
return { ...item, changefreq: 'weekly', priority: 0.9, lastmod: new Date() };
90+
return { ...item, changefreq: 'weekly', priority: 0.9 };
8691
}
8792
if (segments.length === 3 && segments[1] === 'rules') {
8893
// /rules/[group]/ index
89-
return { ...item, changefreq: 'monthly', priority: 0.7, lastmod: new Date() };
94+
return { ...item, changefreq: 'monthly', priority: 0.7 };
9095
}
9196
if (segments.length === 4 && segments[1] === 'rules') {
9297
// /rules/[group]/[service]/ — main content pages
93-
return { ...item, changefreq: 'monthly', priority: 0.8, lastmod: new Date() };
98+
return { ...item, changefreq: 'monthly', priority: 0.8 };
9499
}
95100
// Guide pages and others
96-
return { ...item, changefreq: 'yearly', priority: 0.6, lastmod: new Date() };
101+
return { ...item, changefreq: 'yearly', priority: 0.6 };
97102
},
98103
}),
99104
icon(),

site/src/pages/rules/[group]/[service].astro

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@ const ruleCount = getRuleCount(service);
2222
const groupIndex = data.groups.findIndex((g) => getGroupSlug(g) === groupSlug) + 1;
2323
const serviceIndex = group.services.findIndex((s) => getServiceSlug(s) === serviceSlug) + 1;
2424
25-
// Build exporters summary for meta description
25+
// Build exporters summary for keywords (kept for <meta keywords> but removed from description)
2626
const exporterNames = service.exporters.map((e) => e.name).filter(Boolean).join(', ');
27-
const metaDescBase = `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}${exporterNames ? ` (${exporterNames})` : ''}. Copy-paste YAML for critical and warning alerts.`;
28-
const metaDesc = metaDescBase.length > 160
29-
? `${ruleCount} ready-to-use Prometheus alert rules for ${service.name}. Copy-paste YAML for critical and warning alerts.`
30-
: metaDescBase;
27+
// Description: lead with count + service + format signals. Exporter names go in keywords, not here.
28+
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.`;
3129
3230
// FAQ JSON-LD for GEO (AI search engines)
3331
const faqItems = service.exporters.flatMap((exp) =>
@@ -55,7 +53,7 @@ const jsonLd = {
5553
{
5654
'@type': 'TechArticle',
5755
'@id': `${pageUrl}#article`,
58-
headline: `${service.name} Prometheus Alert Rules`,
56+
headline: `${service.name} Prometheus Alert Rules (${ruleCount})`,
5957
description: metaDesc,
6058
about: `Prometheus monitoring for ${service.name}`,
6159
url: pageUrl,
@@ -76,7 +74,7 @@ const jsonLd = {
7674
---
7775

7876
<BaseLayout
79-
title={`${service.name} Alert Rules | Awesome Prometheus Alerts`}
77+
title={`${service.name} Prometheus Alert Rules (${ruleCount}) | Awesome Prometheus Alerts`}
8078
description={metaDesc}
8179
ogType="article"
8280
keywords={keywords}

site/src/pages/rules/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const redirectMap = buildRedirectMap(base);
1414
const jsonLd = {
1515
'@context': 'https://schema.org',
1616
'@type': 'CollectionPage',
17-
name: 'Prometheus Alerting Rules',
17+
name: `${totalRules} Prometheus Alerting Rules for ${totalServices} Services`,
1818
description: `Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`,
1919
url: `${SITE_URL}rules/`,
2020
isPartOf: schemaWebSite,
@@ -32,7 +32,7 @@ const jsonLd = {
3232
---
3333

3434
<BaseLayout
35-
title="Prometheus Alerting Rules | Awesome Prometheus Alerts"
35+
title={`${totalRules} Prometheus Alerting Rules for ${totalServices} Services | Awesome Prometheus Alerts`}
3636
description={`Browse ${totalRules} Prometheus alerting rules across ${totalServices} services. Organized by category: databases, Kubernetes, cloud providers, message brokers, and more.`}
3737
jsonLd={jsonLd}
3838
>

0 commit comments

Comments
 (0)