Fix title extraction to always use filename/directory name instead of content

- Remove H1 and HTML title extraction from parse methods
- Always use formatDisplayName() for consistent filename-based titles
- Add file path parameters to parseMarkdown() and parseHTML()
- Fix directory precedence to check directories before files
- Update AGENTS.md with title vs filename clarification
- Remove debug code from templates and methods

Resolves: Page titles now consistently show file/directory names
without language prefixes and extensions, never content titles.
This commit is contained in:
2025-11-22 18:00:35 +01:00
parent e1e3207305
commit 561832161e
3 changed files with 50 additions and 24 deletions

View File

@@ -16,4 +16,14 @@
- **Templating**: Simple string replacement `{{placeholder}}` in `templates/layout.html`.
- **Navigation**: Auto-generated from directory structure. Folders require an index file to be clickable in breadcrumbs.
- **Security**: Always use `htmlspecialchars()` for outputting user/content data.
- **Git**: `main` is the clean CMS core. `e.noorlander` contains personal content. Do not mix them.
- **Git**: `main` is the clean CMS core. `e.noorlander` contains personal content. Do not mix them.
## Important: Title vs File/Directory Name Logic
- **CRITICAL**: When user asks for "title" corrections, they usually mean **FILE/DIRECTORY NAME WITHOUT LANGUAGE PREFIX AND EXTENSIONS**, not the HTML title from content!
- **Examples**:
- `nl.test.md` → display as "Test" (not content title)
- `nl.test/` directory → display as "Test" (not H1 content)
- `en.php-testen` → display as "Php Testen" (not "ICT")
- **Method**: Use `formatDisplayName()` to process file/directory names correctly
- **Priority**: Directory names take precedence over file names when both exist
- **Language prefixes**: Always remove `nl.` or `en.` prefixes from display names