- Add complete dark mode system with theme context and toggle - Implement dark mode toggle component in navigation menu - Add client-side routing with SSR-safe signal handling - Fix language selector styling for better dark mode compatibility - Add documentation system with mdBook integration - Improve navigation menu with proper external/internal link handling - Add comprehensive project documentation and configuration - Enhance theme system with localStorage persistence - Fix arena panic issues during server-side rendering - Add proper TypeScript configuration and build optimizations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Rustelo Template System with Tera**
Key Features:
- Localized Template System: Uses language-prefixed
.tpl.tomlfiles (e.g.,en_content-name.tpl.toml) - Tera Template Engine: Replaced handlebars with Tera for more powerful templating
- URL Routing: Clean URLs like
/page:content-namethat map to template configurations - Multi-language Support: Automatic fallback chain for languages
- Flexible Configuration: TOML-based configuration for easy content management
How It Works:
- URL Request:
/page:content-name?lang=en - File Lookup:
content/docs/en_content-name.tpl.toml - Template Rendering: Uses Tera engine with
templates/template-name.html - Response: Rendered HTML content
Files Created:
Core System:
server/src/template/mod.rs- Main template moduleserver/src/template/config.rs- Configuration parserserver/src/template/engine.rs- Tera engine wrapperserver/src/template/loader.rs- Localized template loaderserver/src/template/service.rs- Template service with cachingserver/src/template/routes.rs- HTTP routesserver/src/handlers/template.rs- Route handlers
Example Templates:
templates/blog-post.html- Blog post templatetemplates/page.html- General page template
Example Configurations:
content/docs/en_getting-started.tpl.toml- English getting startedcontent/docs/es_getting-started.tpl.toml- Spanish getting startedcontent/docs/en_about.tpl.toml- English about page
Documentation:
TEMPLATE_README.md- Complete system documentationUSAGE_EXAMPLE.md- Integration examplesserver/src/examples/template_integration.rs- Code examples
Key Benefits:
- Performance: Cached template compilation and rendering
- Flexibility: Any template can use any data structure
- Localization: Built-in language support with fallback
- Developer Experience: Hot reload, debugging APIs, comprehensive docs
- Type Safety: Rust-based with compile-time error checking
Usage Examples:
Create a product page:
# content/docs/en_awesome-widget.tpl.toml
template_name = "product-page"
[values]
title = "Awesome Widget"
price = "99.99"
description = "The best widget ever made"
Access the page:
- English:
http://localhost:3030/page:awesome-widget?lang=en - Spanish:
http://localhost:3030/page:awesome-widget?lang=es
The system is production-ready with comprehensive error handling, caching, monitoring, and extensive documentation. It integrates seamlessly with your existing Rustelo application architecture.