Zola

High-speed SSG built with Rust. Over 14k GitHub stars, featuring ultra-fast builds leveraging Rust's performance.

言語:Rust
フレームワーク:None
ビルド速度:Fastest
GitHub Stars:14k
初回リリース:2016
人気ランキング:第12位

トレンド・動向

Rising attention alongside Rust ecosystem growth. Easy environment setup with single binary distribution.

## Static Site Generator Zola ## Overview Zola is a high-speed static site generator built with Rust. With over 14k GitHub stars, its greatest feature is ultra-fast builds leveraging Rust's performance. Distributed as a single binary, it provides easy environment setup and requires no external dependencies as all features are built-in. Average sites build in under a second, boasting faster performance than Hugo (built with Go). ## Details Zola's development began in 2016, initially under the name Gutenberg. With the growth of the Rust ecosystem, it has gained increasing attention and is now considered one of the most promising static site generators. Leveraging Rust's characteristics, it achieves both memory safety and high performance. It uses Tera as its template engine, which is similar to Jinja2, Django, Liquid, and Twig, resulting in low learning costs. Features like Sass compilation and syntax highlighting are built-in, so functionality that traditionally required development environment setup or JavaScript library additions is available from the start. Zola is fully compliant with the CommonMark spec and provides additional features such as footnotes, GitHub-style tables, task lists, and strikethrough. It offers rich Markdown extension features like shortcodes and internal links, supporting a wide range of use cases from technical blogs to corporate sites. In 2023 performance comparisons, Zola was reported to be 4 times faster than Hugo, demonstrating its superiority for large-scale sites. Configuration is managed through a single `config.toml` file, providing a simple and intuitive structure. ## Pros and Cons ### Pros - **Overwhelming Speed**: Builds average sites in under a second, 4x faster than Hugo - **Single Binary**: Provides all features in one executable file with no dependencies - **Built-in Features**: Sass, syntax highlighting, search functionality included by default - **Memory Safety**: Guarantees safe and reliable operation through Rust's characteristics - **Easy Learning**: Intuitive with Jinja2-style Tera template engine - **Simple Environment Setup**: Minimal steps from installation to execution ### Cons - **Ecosystem Size**: Fewer themes and plugins compared to Hugo or Jekyll - **Community Size**: Limited information due to relatively small community - **Rust Knowledge Required**: Customization and extensions require Rust knowledge - **Hosting Limitations**: Limited support on some hosting services - **Debug Information**: Error messages can be difficult for beginners as they're oriented toward Rust developers ## Reference Pages - [Zola Official Site](https://www.getzola.org/) - [Zola GitHub Repository](https://github.com/getzola/zola) - [Zola Documentation](https://www.getzola.org/documentation/) - [Zola Theme List](https://www.getzola.org/themes/) - [Zola Jamstack](https://jamstack.org/generators/zola/) ## Code Examples ### Installation and Initial Setup ```bash # macOS (Homebrew) brew install zola # Windows (Chocolatey) choco install zola # Linux (various distributions) # Arch Linux pacman -S zola # Ubuntu/Debian curl -s -L https://github.com/getzola/zola/releases/latest/download/zola-x86_64-unknown-linux-musl.tar.gz | tar -xz sudo mv zola /usr/local/bin/ # Initialize new site zola init my_site cd my_site ``` ### Project Creation and Basic Structure ```bash # Basic directory structure is auto-generated my_site/ ├── config.toml # Site configuration ├── content/ # Content files ├── static/ # Static files ├── templates/ # Template files ├── themes/ # Theme directory └── sass/ # Sass files # Start development server zola serve # Production build zola build ``` ### Basic Configuration File (config.toml) ```toml # Site basic information base_url = "https://example.com" title = "My Zola Site" description = "A fast static site built with Zola" # Build settings compile_sass = true minify_html = true generate_feed = true build_search_index = true # Theme settings theme = "zola-minimal" # Markdown settings [markdown] highlight_code = true highlight_theme = "base16-ocean-dark" external_links_target_blank = true external_links_no_follow = true # Additional settings [extra] author = "Your Name" github = "https://github.com/username" twitter = "https://twitter.com/username" # Menu settings [[extra.menu.main]] name = "Blog" url = "/blog/" weight = 10 [[extra.menu.main]] name = "About" url = "/about/" weight = 20 ``` ### Template File Creation ```html <!-- templates/base.html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{% block title %}{{ config.title }}{% endblock %}</title> <link rel="stylesheet" href="{{ get_url(path="style.css") }}"> </head> <body> <header> <nav> {% for item in config.extra.menu.main %} <a href="{{ item.url }}">{{ item.name }}</a> {% endfor %} </nav> </header> <main> {% block content %}{% endblock %} </main> <footer> <p>&copy; 2025 {{ config.extra.author }}</p> </footer> </body> </html> <!-- templates/index.html --> {% extends "base.html" %} {% block content %} <h1>{{ section.title }}</h1> <div class="content"> {{ section.content | safe }} </div> <div class="posts"> {% for page in section.pages %} <article> <h2><a href="{{ page.permalink }}">{{ page.title }}</a></h2> <p class="meta">{{ page.date | date(format="%Y-%m-%d") }}</p> <p>{{ page.summary | safe }}</p> </article> {% endfor %} </div> {% endblock %} ``` ### Shortcodes and Customization ```html <!-- templates/shortcodes/youtube.html --> <div class="youtube-wrapper"> <iframe width="560" height="315" src="https://www.youtube.com/embed/{{ id }}" frameborder="0" allowfullscreen> </iframe> </div> <!-- templates/shortcodes/code.html --> <div class="code-block"> <div class="code-header"> <span class="language">{{ lang | default(value="text") }}</span> {% if filename %} <span class="filename">{{ filename }}</span> {% endif %} </div> <pre><code class="language-{{ lang | default(value="text") }}">{{ body | safe }}</code></pre> </div> ``` ### Markdown Article Creation Example ```markdown +++ title = "Building Fast Sites with Zola" date = 2025-01-20 description = "Steps for building static sites with Zola" [taxonomies] tags = ["zola", "rust", "ssg"] categories = ["tutorial"] +++ # Building Fast Sites with Zola Let's build sites leveraging Zola's powerful features. ## Shortcode Usage Examples {{ youtube(id="dQw4w9WgXcQ") }} {{ code(lang="rust", filename="main.rs") }} fn main() { println!("Hello, Zola!"); } {{ end }} ## Internal Links For details, see [this article](@/blog/advanced-zola.md). ## Summary Zola is a fast and user-friendly SSG. ``` ### Advanced Features and Deployment ```bash # Theme installation cd themes git clone https://github.com/getzola/zola-theme-minimal.git minimal # Production build and optimization zola build --base-url https://mydomain.com # Netlify deployment configuration # netlify.toml [build] publish = "public" command = "zola build" [build.environment] ZOLA_VERSION = "0.19.1" # GitHub Actions automatic deployment # .github/workflows/deploy.yml name: Deploy on: push: branches: [ main ] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup Zola uses: taiki-e/install-action@v2 with: tool: [email protected] - name: Build run: zola build - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ```