Merge pull request #10 from kbenestad/claude/fix-mdcms-build-error-iNz2b

Ensure category codes are converted to strings
This commit is contained in:
Kristian Benestad 2026-05-10 22:55:23 +07:00 committed by GitHub
commit 2302f3278f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -108,9 +108,10 @@ def read_config(site_path: Path) -> dict:
def get_category_info(cfg: dict) -> dict:
use = str(cfg.get("categories-use", "no")).lower() in ("yes", "true")
default_cat = cfg.get("default-category") or {}
default_code = default_cat.get("code") if isinstance(default_cat, dict) else None
raw_default = default_cat.get("code") if isinstance(default_cat, dict) else None
default_code = str(raw_default) if raw_default is not None else None
cats = cfg.get("categories") or []
codes = [c["code"] for c in cats if isinstance(c, dict) and "code" in c]
codes = [str(c["code"]) for c in cats if isinstance(c, dict) and "code" in c]
return {"use": use, "default_code": default_code, "codes": codes}