Implementation Note

Validating related content at build time

Keeps cross-collection relationships inspectable by combining typed references, source-graph checks, and draft-safe resolution before publication.

Problem

Related-content fields are useful only when their destinations exist and their publication state is understood. A handwritten path can remain syntactically valid while pointing to a renamed, missing, or draft-only record.

Relevant environment

Avantlord uses Astro content collections for Work, Research, and Notes. Each relationship is authored as a content ID, and every public page is generated during the static build.

What works

The collection schema uses Astro references to constrain each relationship to its intended collection. A separate source-graph check catches duplicate IDs and missing targets, while the public resolver excludes draft records before related links are rendered.

Constraint

Schema validation establishes that a reference is well formed; it does not replace publication-policy checks. Draft filtering and production-output link checks still have to agree with the source graph.

Practical recommendation

Treat related content as structured data rather than navigation copy. Validate the source graph before building, resolve only public records, and test every generated link against the production output. This keeps the relationship inspectable without adding client-side JavaScript.

Return to the notes index