Skip to content

Simplify installation of zola #1675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[alias]
blog = ["run", "--package", "generate_blog"]
zola = ["run", "--manifest-path", "zola/Cargo.toml", "--"]
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/snapshot_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +0,0 @@
[submodule "zola"]
path = zola
url = https://github.com/getzola/zola
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 --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/).
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 --fast --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
Expand Down
4 changes: 2 additions & 2 deletions crates/snapshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
6 changes: 6 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[tasks]
zola = "zola"
serve = "zola serve --fast --open"

[tools]
zola = "0.21.0"
1 change: 0 additions & 1 deletion zola
Submodule zola deleted from 45d3f8