138 lines
4.1 KiB
Text
138 lines
4.1 KiB
Text
|
|
# Content Data Configuration with KCL
|
||
|
|
# Structured content data for the KCL demo page
|
||
|
|
|
||
|
|
schema FeatureItem:
|
||
|
|
title: str
|
||
|
|
description: str
|
||
|
|
icon: str
|
||
|
|
benefits: [str]
|
||
|
|
code_example?: str
|
||
|
|
|
||
|
|
schema HeroSection:
|
||
|
|
title: str
|
||
|
|
subtitle: str
|
||
|
|
background: str
|
||
|
|
cta: {
|
||
|
|
text: str
|
||
|
|
url: str
|
||
|
|
style: str
|
||
|
|
}
|
||
|
|
|
||
|
|
schema ContentData:
|
||
|
|
hero: HeroSection
|
||
|
|
features: [FeatureItem]
|
||
|
|
testimonials: [TestimonialItem]
|
||
|
|
stats: {str: int}
|
||
|
|
|
||
|
|
schema TestimonialItem:
|
||
|
|
quote: str
|
||
|
|
author: str
|
||
|
|
role: str
|
||
|
|
company: str
|
||
|
|
avatar?: str
|
||
|
|
|
||
|
|
# Page content configuration
|
||
|
|
content: ContentData = {
|
||
|
|
hero = {
|
||
|
|
title = "KCL + Tera + Rust = 🚀"
|
||
|
|
subtitle = "Type-safe configuration, powerful templates, and blazing-fast processing"
|
||
|
|
background = "linear-gradient(135deg, #667eea 0%, #764ba2 100%)"
|
||
|
|
cta = {
|
||
|
|
text = "Explore the Code"
|
||
|
|
url = "#features"
|
||
|
|
style = "primary"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
features = [
|
||
|
|
{
|
||
|
|
title = "Type-Safe Configuration"
|
||
|
|
description = "KCL provides compile-time validation and IntelliSense support"
|
||
|
|
icon = "🛡️"
|
||
|
|
benefits = [
|
||
|
|
"Catch configuration errors at build time"
|
||
|
|
"Auto-completion in VS Code"
|
||
|
|
"Schema validation and documentation"
|
||
|
|
"Refactoring support across configs"
|
||
|
|
]
|
||
|
|
code_example = '''schema SiteConfig:
|
||
|
|
title: str
|
||
|
|
nav: [NavItem]
|
||
|
|
|
||
|
|
site: SiteConfig = {
|
||
|
|
title = "My Site"
|
||
|
|
nav = [
|
||
|
|
{ title = "Home", url = "/" }
|
||
|
|
]
|
||
|
|
}'''
|
||
|
|
}
|
||
|
|
{
|
||
|
|
title = "Powerful Templating"
|
||
|
|
description = "Tera templates with rich data context from KCL and frontmatter"
|
||
|
|
icon = "📝"
|
||
|
|
benefits = [
|
||
|
|
"Jinja2-like syntax with Rust performance"
|
||
|
|
"Automatic escaping and security"
|
||
|
|
"Rich filter and function library"
|
||
|
|
"Template inheritance and includes"
|
||
|
|
]
|
||
|
|
code_example = '''<nav class="main-nav">
|
||
|
|
{% for item in site.navigation %}
|
||
|
|
<a href="{{ item.url }}"
|
||
|
|
{% if item.external %}target="_blank"{% endif %}>
|
||
|
|
{{ item.icon }} {{ item.title }}
|
||
|
|
</a>
|
||
|
|
{% endfor %}
|
||
|
|
</nav>'''
|
||
|
|
}
|
||
|
|
{
|
||
|
|
title = "Rust-Powered Processing"
|
||
|
|
description = "Lightning-fast Markdown processing and asset optimization"
|
||
|
|
icon = "⚡"
|
||
|
|
benefits = [
|
||
|
|
"Blazing-fast Markdown compilation"
|
||
|
|
"Memory-safe processing"
|
||
|
|
"Parallel asset optimization"
|
||
|
|
"Zero-cost abstractions"
|
||
|
|
]
|
||
|
|
code_example = '''// Rust Markdown processing
|
||
|
|
use pulldown_cmark::{Parser, Options, html};
|
||
|
|
|
||
|
|
let mut options = Options::empty();
|
||
|
|
options.insert(Options::ENABLE_TABLES);
|
||
|
|
let parser = Parser::new_ext(markdown, options);
|
||
|
|
html::push_html(&mut output, parser);'''
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
testimonials = [
|
||
|
|
{
|
||
|
|
quote = "The combination of KCL's type safety with Tera's flexibility is a game-changer for our static site workflow."
|
||
|
|
author = "Sarah Chen"
|
||
|
|
role = "Lead Developer"
|
||
|
|
company = "TechCorp"
|
||
|
|
avatar = "/images/avatars/sarah.jpg"
|
||
|
|
}
|
||
|
|
{
|
||
|
|
quote = "Moving from YAML to KCL eliminated entire classes of configuration bugs. The schema validation is incredible."
|
||
|
|
author = "Miguel Rodriguez"
|
||
|
|
role = "DevOps Engineer"
|
||
|
|
company = "CloudStart"
|
||
|
|
avatar = "/images/avatars/miguel.jpg"
|
||
|
|
}
|
||
|
|
{
|
||
|
|
quote = "The performance improvement over our previous Node.js setup is dramatic. Rust + KCL + Tera is the perfect stack."
|
||
|
|
author = "Alex Kumar"
|
||
|
|
role = "Full Stack Developer"
|
||
|
|
company = "FastSites"
|
||
|
|
avatar = "/images/avatars/alex.jpg"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
|
||
|
|
stats = {
|
||
|
|
"Build Speed Improvement" = 300 # 3x faster
|
||
|
|
"Configuration Errors Eliminated" = 95 # 95% reduction
|
||
|
|
"Memory Usage Reduction" = 60 # 60% less memory
|
||
|
|
"Developer Satisfaction" = 98 # 98% satisfaction rate
|
||
|
|
}
|
||
|
|
}
|