Generation: classify localized page-category post paths ({lang}/{slug}/index.html) #85

Closed
opened 2026-07-20 19:44:01 +00:00 by hugo · 1 comment
Owner

Source: Audit section 2.15 (second half). Verify first, then fix.

Context: Page-category posts render at /{slug}/index.html in every language tree (specs/generation.allium GenerateCoreSectionPages, MultiLanguageRoutes). classify_generated_path (crates/bds-core/src/engine/generation.rs ~line 761) maps [slug, "index.html"] → Core, but for ["de", "about", "index.html"] the prefix-stripping helper has_language_prefix doesn't fire (second segment is a slug, not one of index.html/404.html/page/year/category/tag), so the 3-segment path falls through to None — excluded from section-scoped validation apply and stale-page cleanup.

Task: Write a failing test for classify_generated_path("de/about/index.html") (expect Core, matching the unprefixed variant), then fix the prefix detection (best solved together with the blogLanguages-driven prefix issue — if the first segment is a configured language, strip it and classify the remainder; beware ambiguity with a page post whose slug equals a language code, mirror whatever bDS2 does in its path classification — see ../bDS2/lib/bds/generation.ex).

Acceptance: Localized page-post paths classify as Core; validation apply rewrites/cleans them like their main-language counterparts.

**Source:** Audit section 2.15 (second half). Verify first, then fix. **Context:** Page-category posts render at `/{slug}/index.html` in every language tree (`specs/generation.allium` GenerateCoreSectionPages, MultiLanguageRoutes). `classify_generated_path` (`crates/bds-core/src/engine/generation.rs` ~line 761) maps `[slug, "index.html"]` → Core, but for `["de", "about", "index.html"]` the prefix-stripping helper `has_language_prefix` doesn't fire (second segment is a slug, not one of index.html/404.html/page/year/category/tag), so the 3-segment path falls through to None — excluded from section-scoped validation apply and stale-page cleanup. **Task:** Write a failing test for `classify_generated_path("de/about/index.html")` (expect Core, matching the unprefixed variant), then fix the prefix detection (best solved together with the blogLanguages-driven prefix issue — if the first segment is a configured language, strip it and classify the remainder; beware ambiguity with a page post whose slug equals a language code, mirror whatever bDS2 does in its path classification — see `../bDS2/lib/bds/generation.ex`). **Acceptance:** Localized page-post paths classify as Core; validation apply rewrites/cleans them like their main-language counterparts.
hugo added the bug label 2026-07-20 19:44:01 +00:00
Author
Owner

Implemented in 556d9c1. Configured language prefixes are now stripped before all generated-route classification, so localized page-category paths such as de/about/index.html classify as Core just like about/index.html. Added a red/green classifier regression plus an end-to-end validation test that repairs a tampered localized page, deletes a stale localized page, and leaves validation clean. Updated README. Neutral review confirmed parity with bDS2 extract_language_path and specs/generation.allium MultiLanguageRoutes/GenerateCoreSectionPages. cargo build --workspace and cargo test --workspace pass.

Implemented in 556d9c1. Configured language prefixes are now stripped before all generated-route classification, so localized page-category paths such as de/about/index.html classify as Core just like about/index.html. Added a red/green classifier regression plus an end-to-end validation test that repairs a tampered localized page, deletes a stale localized page, and leaves validation clean. Updated README. Neutral review confirmed parity with bDS2 extract_language_path and specs/generation.allium MultiLanguageRoutes/GenerateCoreSectionPages. cargo build --workspace and cargo test --workspace pass.
hugo closed this issue 2026-07-22 16:06:25 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#85