@grove-dev/astro 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grove-dev/astro",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "description": "Astro integration + server view-models for Grove directories. UI ships from @grove-dev/registry, not from this package.",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  "sanitize-html": "^2.17.7",
52
52
  "shiki": "^4.4.3",
53
53
  "yaml": "^2.9.0",
54
- "@grove-dev/core": "1.0.1"
54
+ "@grove-dev/core": "1.1.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "astro": "^6.0.0 || ^7.0.0"
@@ -400,6 +400,13 @@ const PAGE_BODY_ALLOWLIST = [
400
400
  'pre',
401
401
  'blockquote',
402
402
  'img',
403
+ // Tables: comparison grids in guides (e.g. licence pages).
404
+ 'table',
405
+ 'thead',
406
+ 'tbody',
407
+ 'tr',
408
+ 'th',
409
+ 'td',
403
410
  ];
404
411
 
405
412
  /**
@@ -78,6 +78,19 @@ export interface SiteIndexPolicy {
78
78
  taxonomyIndexPolicy?: string;
79
79
  }
80
80
 
81
+ /**
82
+ * A category, stack or licence term with its optional editorial copy
83
+ * from `data/taxonomy/*.yml`: `description` is the page lede and meta
84
+ * description, `heading` the H1, `seoTitle` the `<title>`.
85
+ */
86
+ export interface TaxonomyTermCopy {
87
+ id: string;
88
+ name: string;
89
+ description?: string;
90
+ heading?: string;
91
+ seoTitle?: string;
92
+ }
93
+
81
94
  export interface DirectorySiteConfig {
82
95
  name: string;
83
96
  tagline?: string;
@@ -120,11 +133,11 @@ export interface DirectorySiteConfig {
120
133
  labelPlural?: string;
121
134
  };
122
135
  taxonomy?: {
123
- categories?: Array<{ id: string; name: string; description?: string }>;
124
- stacks?: Array<{ id: string; name: string; description?: string }>;
136
+ categories?: Array<TaxonomyTermCopy>;
137
+ stacks?: Array<TaxonomyTermCopy>;
125
138
  platforms?: Array<{ id: string; name: string }>;
126
139
  topics?: Array<{ id: string; name: string }>;
127
- licenses?: Array<{ id: string; name: string }>;
140
+ licenses?: Array<TaxonomyTermCopy>;
128
141
  distributionChannels?: Array<{ id: string; name: string }>;
129
142
  };
130
143
  contributors?: {
@@ -1126,7 +1139,7 @@ export function getTaxonomyPageModel(
1126
1139
  ? `${titleCaseFirst(plural)} built with ${displayName} on ${site.name}`
1127
1140
  : `${licenseLabel}-licensed ${plural} on ${site.name}`;
1128
1141
  const description = seoDescription(
1129
- undefined,
1142
+ site.taxonomy?.[kind]?.find((t) => t.id === id)?.description,
1130
1143
  kind === 'categories'
1131
1144
  ? `${count} curated open-source ${plural} in the ${displayName} category on ${site.name}. Compare stars, activity, and licenses.`
1132
1145
  : kind === 'stacks'
@@ -1149,13 +1162,11 @@ export function getTaxonomyPageModel(
1149
1162
  ...(r.description ? { description: r.description } : {}),
1150
1163
  };
1151
1164
  });
1152
- // `seo.taxonomyIndexPolicy` covers categories and stacks — the pages
1153
- // a term's intro copy (`description` in data/taxonomy) is written for.
1154
- // Licenses have no editorial copy and are not covered. An empty term
1155
- // is left to the page, as before.
1156
- const term = kind === 'licenses' ? undefined : site.taxonomy?.[kind]?.find((t) => t.id === id);
1165
+ // `seo.taxonomyIndexPolicy` covers categories, stacks and licences:
1166
+ // under `editorial` a term needs intro copy (`description` in
1167
+ // data/taxonomy). An empty term is left to the page, as before.
1168
+ const term = site.taxonomy?.[kind]?.find((t) => t.id === id);
1157
1169
  const excludedByPolicy =
1158
- kind !== 'licenses' &&
1159
1170
  count > 0 &&
1160
1171
  !taxonomyTermIndexable(
1161
1172
  { count, description: term?.description },
@@ -1165,7 +1176,7 @@ export function getTaxonomyPageModel(
1165
1176
  ...(excludedByPolicy ? { noindex: true, robots: NOINDEX_FOLLOW } : {}),
1166
1177
  // `main` already names the site, so seoTitle appends nothing —
1167
1178
  // it still runs for the length/whitespace normalization.
1168
- title: seoTitle(main, site.name),
1179
+ title: seoTitle(term?.seoTitle?.trim() || term?.heading?.trim() || main, site.name),
1169
1180
  description,
1170
1181
  image: ogPath(kind === 'categories' ? 'category' : kind === 'stacks' ? 'stack' : 'license', id),
1171
1182
  imageAlt: `${displayName} — ${site.name}`,
@@ -1188,6 +1199,10 @@ export function getTaxonomyPageModel(
1188
1199
  id,
1189
1200
  displayName,
1190
1201
  eyebrow: TAXONOMY_EYEBROW[kind],
1202
+ /** Editorial H1 (`heading`), when the term has one. */
1203
+ heading: term?.heading?.trim() || undefined,
1204
+ /** Editorial lede (`description`), when the term has one. */
1205
+ lede: term?.description?.trim() || undefined,
1191
1206
  records,
1192
1207
  count,
1193
1208
  seo,