Add taxonomy collection and dynamic taxonomy page template#408
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
et3 | 89663d4 | Commit Preview URL Branch Preview URL |
Jan 16 2026, 01:15 AM |
Summary of ChangesHello @zz-plant, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request establishes a robust, template-driven taxonomy system for the site. It enables the creation of consistently structured taxonomy pages by centralizing content in a JSON file, validating its structure with Zod schemas, and dynamically rendering pages with rich metadata and navigational capabilities. The primary goal is to provide a scalable and maintainable way to organize and present hierarchical content, ensuring a uniform user experience across all taxonomy-related pages. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new taxonomy system, which is a great addition for organizing content. The changes include new data files, TypeScript types, and Astro content collection schemas. My review focuses on improving the robustness and maintainability of the new code. I've suggested strengthening the Zod schema validation for taxonomy artifacts to ensure data consistency and prevent invalid links. I also recommended a structural improvement to automatically infer TypeScript types from the Zod schemas, which will make future maintenance easier and less error-prone. Overall, this is a well-structured feature addition.
| const taxonomyArtifactSchema = z.object({ | ||
| label: z.string(), | ||
| href: z.string(), | ||
| type: z.string(), | ||
| }); |
There was a problem hiding this comment.
The taxonomyArtifactSchema can be made more robust and consistent with other schemas in the project.
- HREF Validation: The
hreffield is a plain string. To prevent invalid links, you could add validation to ensure it's a valid URL or path. A similar validation is already used for thehreffield in theparticipationcollection'sopenSourceschema. - Type Enum: The
typefield currently accepts any string. Based on the data insrc/content/taxonomy.json, there's a specific set of artifact types. Usingz.enum()for this field would enforce consistency and prevent typos.
Here is a suggested update:
| const taxonomyArtifactSchema = z.object({ | |
| label: z.string(), | |
| href: z.string(), | |
| type: z.string(), | |
| }); | |
| const taxonomyArtifactSchema = z.object({ | |
| label: z.string(), | |
| href: z.string().refine((val) => ["http", "/", "#", "mailto:"].some(prefix => val.startsWith(prefix)), { message: "href must be a valid URL, mailto, or path" }), | |
| type: z.enum(["agenda", "catalog", "doctrine", "framework", "guide", "playbook", "policy", "program", "reference", "research", "standard", "tools", "workflow"]), | |
| }); |
| export type TaxonomyArtifact = { | ||
| label: string; | ||
| href: string; | ||
| type: string; | ||
| }; | ||
|
|
||
| export type TaxonomyEntry = { | ||
| id: string; | ||
| title: string; | ||
| slug: string; | ||
| summary: string; | ||
| owner: string; | ||
| scope: string; | ||
| readiness: "draft" | "alpha" | "beta" | "stable"; | ||
| relatedArtifacts: TaxonomyArtifact[]; | ||
| }; |
There was a problem hiding this comment.
To improve maintainability and prevent types from becoming out of sync with their corresponding Zod schemas, consider deriving the TypeScript types directly from the schemas using z.infer.
Currently, TaxonomyArtifact and TaxonomyEntry are defined manually, duplicating the structure from src/content.config.ts. This is error-prone, as a change in one place requires a manual update in the other.
By co-locating the schemas and types (e.g., moving the Zod schemas from content.config.ts to this file) and using z.infer, you can ensure they are always synchronized. content.config.ts can then import the schemas from here.
For example:
import { z } from "zod";
export const taxonomyArtifactSchema = z.object({
// ... schema definition
});
export type TaxonomyArtifact = z.infer<typeof taxonomyArtifactSchema>;
export const taxonomyEntrySchema = z.object({
// ... schema definition
});
export type TaxonomyEntry = z.infer<typeof taxonomyEntrySchema>;This approach makes the codebase more robust and easier to maintain.
Motivation
Description
src/content/taxonomy.jsonseeded with 15+ taxonomy entries describing slug, owner, scope, readiness, summary, and related artifacts.src/content/taxonomy.tswith TypeScript types and an exportedtaxonomyEntriesarray.src/content.config.tswith ataxonomycollection and Zod schema (taxonomyEntrySchemaandtaxonomyArtifactSchema) so the collection is validated at build time.src/pages/taxonomy/[...slug].astrothatprerenders and usesgetStaticPathsto create pages for each entry and renders summary, metadata panel, related artifacts, and links to parent, sibling, and child taxonomy levels.docs/content-data.mdwith guidance for the taxonomy schema and validation notes.Testing
bun run check(parallel checks) which includesLint,Unit Tests,Typecheck,Astro Check,Validate JSON, andValidate Glossary, and all checks passed.Codex Task