From edaa11aac1e7b992b77b60b3a278afa3bfbb1a96 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sat, 9 Aug 2025 11:14:12 +0200 Subject: [PATCH 1/2] Simplify installation of zola --- .cargo/config.toml | 1 - .github/workflows/main.yml | 8 +++----- .github/workflows/snapshot_tests.yml | 6 ++---- .gitmodules | 3 --- README.md | 20 ++++++++++++++++---- crates/snapshot/src/lib.rs | 4 ++-- mise.toml | 6 ++++++ zola | 1 - 8 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 mise.toml delete mode 160000 zola diff --git a/.cargo/config.toml b/.cargo/config.toml index 3fe4469e5..a9b0b23cc 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,2 @@ [alias] blog = ["run", "--package", "generate_blog"] -zola = ["run", "--manifest-path", "zola/Cargo.toml", "--"] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 02aad2efe..a5a91610e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,15 +28,13 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - submodules: true - run: rustup override set ${{ env.RUST_VERSION }} - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 - with: - workspaces: ".\nzola" # needed to cache build of zola in ./zola/target + - name: Install Zola + run: cargo install --locked --git https://github.com/getzola/zola --rev 45d3f8d6285f0b47013c5fa31eb405332118af8b - - run: cargo zola build + - run: zola build - run: cp CNAME ./public/ - run: touch public/.nojekyll diff --git a/.github/workflows/snapshot_tests.yml b/.github/workflows/snapshot_tests.yml index 7cb5ca6e4..ee9308f4b 100644 --- a/.github/workflows/snapshot_tests.yml +++ b/.github/workflows/snapshot_tests.yml @@ -12,12 +12,10 @@ jobs: if: contains(github.event.pull_request.body, 'RUN_SNAPSHOT_TESTS') steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - with: - submodules: true - run: rustup override set ${{ env.RUST_VERSION }} - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0 - with: - workspaces: ".\nzola" # needed to cache build of zola in ./zola/target + - name: Install Zola + run: cargo install --locked --git https://github.com/getzola/zola --rev 45d3f8d6285f0b47013c5fa31eb405332118af8b - run: git fetch --depth 2 - run: git checkout origin/master diff --git a/.gitmodules b/.gitmodules index f538c9306..e69de29bb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "zola"] - path = zola - url = https://github.com/getzola/zola diff --git a/README.md b/README.md index 4977df4a7..dbcf0c598 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,28 @@ This is the blog of the Rust Programming Language. It uses [Zola](https://www.getzola.org/) and is deployed to GitHub Pages via GitHub Actions. +## Installing Zola + +You need at least zola v0.21.0 to render the blog. + +Compile from source: + +```sh +cargo install --locked --git https://github.com/getzola/zola --rev 45d3f8d6285f0b47013c5fa31eb405332118af8b +``` + +You can also find a list of package managers that provide zola [here](https://www.getzola.org/documentation/getting-started/installation/). +Prebuilt binaries are available for download [here](https://github.com/getzola/zola/releases/tag/v0.21.0). +If you use [mise](https://mise.jdx.dev), you can run the pinned version of zola directly with `mise run zola`. + ## Building -To serve the site locally, first make sure the zola submodule is initialized: +To serve the site locally, run the following: ```sh -git submodule update --init --recursive +zola serve --open ``` -Now run `cargo zola serve --open`. -(The first run takes a while to compile Zola.) The site will be reloaded automatically when you make any changes. ## Contributing diff --git a/crates/snapshot/src/lib.rs b/crates/snapshot/src/lib.rs index 1989a68e8..44a78be29 100644 --- a/crates/snapshot/src/lib.rs +++ b/crates/snapshot/src/lib.rs @@ -2,8 +2,8 @@ fn snapshot() { std::env::set_current_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/../..")).unwrap(); let _ = std::fs::remove_dir_all("public"); - let status = std::process::Command::new("cargo") - .args(["zola", "build"]) + let status = std::process::Command::new("zola") + .arg("build") .status() .unwrap(); assert!(status.success(), "failed to build site"); diff --git a/mise.toml b/mise.toml new file mode 100644 index 000000000..ede35a8f0 --- /dev/null +++ b/mise.toml @@ -0,0 +1,6 @@ +[tasks] +zola = "zola" +serve = "zola serve --open" + +[tools] +zola = "0.21.0" diff --git a/zola b/zola deleted file mode 160000 index 45d3f8d62..000000000 --- a/zola +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 45d3f8d6285f0b47013c5fa31eb405332118af8b From 05a655f075d7a5db1b3c04e41d0b3418429f243c Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sat, 9 Aug 2025 19:41:29 +0200 Subject: [PATCH 2/2] Recommend to compile zola in debug mode Zola takes a long time to compile. For blog authors, it's probably better to compile zola a little faster while sacrificing some performance when building the site. By default, zola rebuilds every page when something changes. Debug builds perform noticeably worse in that case. But with the `--fast` flag, zola only rebuilds pages that actually changed. With that, the performance of debug and release builds not not noticeably different. --- README.md | 4 ++-- mise.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index dbcf0c598..7dc0c8281 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ You need at least zola v0.21.0 to render the blog. Compile from source: ```sh -cargo install --locked --git https://github.com/getzola/zola --rev 45d3f8d6285f0b47013c5fa31eb405332118af8b +cargo install --debug --locked --git https://github.com/getzola/zola --rev 45d3f8d6285f0b47013c5fa31eb405332118af8b ``` You can also find a list of package managers that provide zola [here](https://www.getzola.org/documentation/getting-started/installation/). @@ -25,7 +25,7 @@ If you use [mise](https://mise.jdx.dev), you can run the pinned version of zola To serve the site locally, run the following: ```sh -zola serve --open +zola serve --fast --open ``` The site will be reloaded automatically when you make any changes. diff --git a/mise.toml b/mise.toml index ede35a8f0..5c1ae7b83 100644 --- a/mise.toml +++ b/mise.toml @@ -1,6 +1,6 @@ [tasks] zola = "zola" -serve = "zola serve --open" +serve = "zola serve --fast --open" [tools] zola = "0.21.0"