fix: Ensure pagepath ends with a slash

- Use section_current.path for default page path
- Append slash if pagepath is not empty and doesn't end with one
This commit is contained in:
Mahmoud-Emad
2025-10-15 02:07:52 +03:00
parent f5694dd4d7
commit fc9142b005

View File

@@ -89,9 +89,13 @@ fn play_pages(mut plbook PlayBook, mut site Site) ! {
// get sectionname from category, page_category or section, if not specified use current section
section_name := p.get_default('category', p.get_default('page_category', p.get_default('section',
section_current.name)!)!)!
mut pagepath := p.get_default('path', section_name)!
mut pagepath := p.get_default('path', section_current.path)!
pagepath = pagepath.trim_space().trim('/')
pagepath = texttools.name_fix(pagepath)
// Ensure pagepath ends with / to indicate it's a directory path
if pagepath.len > 0 && !pagepath.ends_with('/') {
pagepath += '/'
}
mut mypage := Page{
section_name: section_name