Skip to content

Validate URL-like frontmatter fields in content schema #37

@plx

Description

@plx

Summary

Content schema fields that are semantically URLs are currently typed as plain strings, so invalid URLs in frontmatter are not rejected at validation time.

Affected file:

  • src/content/config.ts

Examples:

  • demoURL
  • repoURL
  • (and any other URL-like metadata fields)

Why This Matters

Schema validation should fail early on malformed metadata, preventing broken links from entering generated pages.

Proposed Strategy

  • Update URL-like fields to use Zod URL validation (e.g., z.string().url().optional()).
  • Decide if relative URLs are allowed; if yes, add a custom validator for absolute-or-relative policy.
  • Update existing content entries if validation uncovers malformed values.

Done Criteria / Validation

  • Invalid URL frontmatter fails astro check.
  • Existing valid content still passes.
  • npm run build and npm run validate:links pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions