Static Data Gen
A fast, secure, and comprehensive static site structured data generator library written in Rust.
• Website • Documentation • Report Bug • Request Feature • Contributing Guidelines
Overview 🚀
staticdatagen is a robust Rust library that streamlines the generation of structured data and metadata for static sites. It provides a comprehensive suite of tools for creating HTML files, RSS feeds, sitemaps, and SEO-friendly metadata, with built-in security features and multi-language support.
Features ✨
Content Generation & Processing
-
Markdown to HTML Conversion
- Clean, semantic HTML output
- Syntax highlighting support
- Custom template integration
- Content minification
-
Metadata Generation
- OpenGraph and Twitter Card meta tags
- JSON-LD support for rich snippets
- Automatic metadata extraction
- SEO optimization
Site Structure & Navigation
-
Navigation System
- Automatic menu generation
- Hierarchical structure support
- Accessibility-compliant markup
- Customizable formatting
-
Multi-language Support
- Built-in support for English, French, and German
- Extensible translation system
- Language-specific templates
- i18n content management
Data Format Support
-
Sitemaps
- Standard XML sitemaps
- Google News sitemaps
- Automatic URL generation
- Change frequency tracking
-
Feed Generation
- RSS 2.0 support
- Atom feed generation
- Custom feed templates
- Auto-updating timestamps
Security & Validation
-
Security Features
- Path traversal prevention
- Input sanitization
- URL validation
- Security.txt generation (RFC 9116)
-
Data Validation
- Metadata verification
- URL structure checking
- Language code validation
- Content integrity checks
Developer Experience
-
Error Handling
- Comprehensive error types
- Detailed error messages
- Context-aware failures
- Recovery suggestions
-
Performance
- Efficient file processing
- HTML minification
- Parallel processing where possible
- Memory-efficient operations
Installation 📦
Add staticdatagen to your Cargo.toml:
[]
= "0.0.6"
Directory Structure 📁
Create the following directory structure for your project:
Usage 💻
Basic Example
use compile;
use Path;
Generated Files 📄
The library generates the following files:
-
HTML Files
- Minified and optimized
- Accessibility-compliant
- SEO-friendly structure
-
Metadata Files
security.txt- Security policy (RFC 9116)humans.txt- Site credits and informationrobots.txt- Crawler instructionsmanifest.json- PWA manifest
-
SEO Files
sitemap.xml- Standard sitemapnews-sitemap.xml- Google News sitemaprss.xml- Content syndication feed
Error Handling 🛠️
The library uses the anyhow crate for error handling, providing detailed error messages and context. All public functions return Result types with comprehensive error information:
use Result;
Performance 🚀
- File Processing: Efficient streaming for large files
- Minification: Optimized HTML output
- Caching: Template and content caching
- Memory Usage: Minimal memory footprint
Documentation 📚
For full API documentation, please visit docs.rs/staticdatagen.
Examples 🎯
To explore more examples, clone the repository and run the following command:
cargo run --example example_name
Contributing 🤝
Contributions are welcome! Please feel free to submit a Pull Request.
License 📜
This project is licensed under either of
at your option.
Acknowledgements 💝
Special thanks to all contributors who have helped build the staticdatagen library.