Skip to content

Add memo field to bibliography schema #22

@Rindrics

Description

@Rindrics

Purpose

Enable users to store internal notes (memos) in the YAML metadata that are not exposed to the frontend.

Requirements

  • Add memo field to CustomInfo type in TypeScript
  • Allow users to write memo entries in custom_info.yaml
  • Ensure memo field is excluded from the generated bibliography.json output
  • Maintain type safety and build validation

Implementation Details

1. Update Type Definitions

File: web/src/lib/types.ts

Add optional memo field to both interfaces:

export interface CustomInfo {
      tags?: string[];
      review?: string;
      memo?: string; // New field
}

export interface CustomInfoYaml {
      [entryId: string]: {
              [siteId: string]: {
                      tags?: string[];
                      review?: string;
                      memo?: string; // New field
              };
      };
}

2. Filter memo in Data Generation

File: web/scripts/generate-data.ts

Modify the mergeBibliography function to exclude memo from output:
function mergeBibliography(
      entries: BibEntry[],
      customInfo: Map<string, CustomInfo>
): BibliographyItem[] {
      return entries.map((entry) => {
              const info = customInfo.get(entry.id);
              return {
                      ...entry,
                      customInfo: info
                              ? {
                                              tags: info.tags,
                                              review: info.review
                                              // memo is intentionally excluded
                                      }
                              : undefined
              };
      });
}

3. Example Usage in YAML

File: contents/custom_info.yaml

Users can now add memos:
suwa-2018-karadaga-umidasu:
  akirahayashi_com:
    tags:
      - performance
      - embodied-learning
    review: A comprehensive guide on embodied creative practices...
    memo: Internal note about this reference (not visible in frontend)

Validation

- pnpm check passes with no type errors
- pnpm generate-data successfully generates bibliography.json
- Verify memo field is NOT present in generated JSON
- pnpm build completes successfully
- Frontend still displays reviews correctly without memo

Test Output Example

After running pnpm generate-data, the output should be:
{
  "id": "suwa-2018-karadaga-umidasu",
  "customInfo": {
    "tags": ["performance", "embodied-learning"],
    "review": "A comprehensive guide..."
    // ← memo is NOT here
  }
}

Benefits

-  Internal notes are preserved in source YAML
-  Frontend remains lean with minimal data transfer
-  Type-safe implementation
-  No breaking changes to existing API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions