-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Purpose
Enable users to store internal notes (memos) in the YAML metadata that are not exposed to the frontend.
Requirements
- Add
memofield toCustomInfotype in TypeScript - Allow users to write memo entries in
custom_info.yaml - Ensure memo field is excluded from the generated
bibliography.jsonoutput - 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 APIReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels