Skip to content

Add id slug field to metadata#43

Merged
marcarl merged 1 commit intomainfrom
feature/add-id-slug-frontmatter
Jan 7, 2026
Merged

Add id slug field to metadata#43
marcarl merged 1 commit intomainfrom
feature/add-id-slug-frontmatter

Conversation

@marcarl
Copy link
Copy Markdown
Collaborator

@marcarl marcarl commented Jan 7, 2026

Summary

  • Adds a new id field at the top of the YAML frontmatter in all documents
  • The id is generated from beteckningSortable in the format sfs-YYYY-NNN (e.g., sfs-2024-1000)
  • Refactors filename generation to use the id slug (filenames remain unchanged: sfs-2024-1000.md)
  • Updates frontmatter sorting to ensure id appears first

Changes

  • sfs_processor.py:
    • New create_id_slug() function to generate clean slug from beteckningSortable
    • Updated create_safe_filename() to use id slug as input (filenames unchanged)
    • Modified frontmatter generation to include id field at the top
    • The id field value matches the filename (without .md extension)
  • formatters/sort_frontmatter.py:
    • Added id to PROPERTY_ORDER as the first field

Example

---
id: sfs-2010-800
beteckning: "2010:800"
rubrik: Skollag
normtyp: Lag
...
---

Filename: sfs-2010-800.md

🤖 Generated with Claude Code

- Add create_id_slug() function to generate clean slug from beteckningSortable
- Add 'id' field at the top of YAML frontmatter (format: sfs-YYYY-NNN)
- Update filenames to use id slug instead of beteckning
  - Standard files: sfs-2024-1000.md
  - Markers files: sfs-2024-1000-markers.md
- Update frontmatter sorting to prioritize 'id' field first
- ID is generated from beteckningSortable, falling back to beteckning if needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@marcarl marcarl changed the title Add id slug field to frontmatter and update filenames Add id slug field to metadata Jan 7, 2026
@marcarl marcarl merged commit 386dd42 into main Jan 7, 2026
5 checks passed
@marcarl marcarl deleted the feature/add-id-slug-frontmatter branch January 7, 2026 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant