From 41f69a174a8bbb2fd049792a91db6c8289f781ee Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Mon, 2 Jun 2025 23:51:26 +0200 Subject: [PATCH 1/3] Add Zola as submodule --- .gitmodules | 3 +++ zola | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 zola diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f538c9306 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "zola"] + path = zola + url = https://github.com/getzola/zola diff --git a/zola b/zola new file mode 160000 index 000000000..4cc4dedff --- /dev/null +++ b/zola @@ -0,0 +1 @@ +Subproject commit 4cc4dedff832c8fdccd3185d19696435141998b3 From ffbc464e52234679c9a43c71f606233c09b28b3c Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Mon, 2 Jun 2025 23:54:36 +0200 Subject: [PATCH 2/3] Add cargo alias to run Zola in submodule --- .cargo/config.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index a9b0b23cc..3fe4469e5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,3 @@ [alias] blog = ["run", "--package", "generate_blog"] +zola = ["run", "--manifest-path", "zola/Cargo.toml", "--"] From e3bc8a9d69cee348408ad61af6f37a0b9a023523 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sun, 1 Jun 2025 15:04:54 +0200 Subject: [PATCH 3/3] Switch to upstream Zola All of the patches we needed for the migration have been merged upstream (with some modifications, hence the `sort_by = "permalink"` diff). We use a submodule of Zola so we can better control the version of Zola that blog authors are running locally. --- .github/workflows/main.yml | 6 +++--- .github/workflows/snapshot_tests.yml | 4 ++-- README.md | 8 ++++---- content/_index.md | 1 + content/inside-rust/_index.md | 1 + crates/snapshot/src/lib.rs | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ab6585843..b4404b79a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,13 +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@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 - - name: Install Zola - run: cargo install --locked --git https://github.com/senekor/zola --rev 79410eea82f837e4de9b1e4c3905287060b69255 - - run: zola build + - run: cargo 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 1c40abd68..0768ca982 100644 --- a/.github/workflows/snapshot_tests.yml +++ b/.github/workflows/snapshot_tests.yml @@ -12,10 +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@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8 - - name: Install Zola - run: cargo install --locked --git https://github.com/senekor/zola --rev 79410eea82f837e4de9b1e4c3905287060b69255 - run: git fetch --depth 2 - run: git checkout origin/master diff --git a/README.md b/README.md index 324be0b89..4977df4a7 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,14 @@ It uses [Zola](https://www.getzola.org/) and is deployed to GitHub Pages via Git ## Building -To serve the site locally, first install Zola: (takes a couple minutes) +To serve the site locally, first make sure the zola submodule is initialized: ```sh -# using a fork because we rely on a few patches that haven't landed yet -cargo install --locked --git https://github.com/senekor/zola --rev 79410eea82f837e4de9b1e4c3905287060b69255 +git submodule update --init --recursive ``` -Now run `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/content/_index.md b/content/_index.md index 348474b7d..1db41e9d8 100644 --- a/content/_index.md +++ b/content/_index.md @@ -1,6 +1,7 @@ +++ title = "Rust Blog" description = "Empowering everyone to build reliable and efficient software." +sort_by = "permalink" generate_feeds = true [extra] index_title = "The Rust Programming Language Blog" diff --git a/content/inside-rust/_index.md b/content/inside-rust/_index.md index 9cf9438c9..8231cb9ef 100644 --- a/content/inside-rust/_index.md +++ b/content/inside-rust/_index.md @@ -1,6 +1,7 @@ +++ title = "Inside Rust Blog" description = "Want to follow along with Rust development? Curious how you might get involved? Take a look!" +sort_by = "permalink" generate_feeds = true [extra] index_title = 'The "Inside Rust" Blog' diff --git a/crates/snapshot/src/lib.rs b/crates/snapshot/src/lib.rs index 44a78be29..1989a68e8 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("zola") - .arg("build") + let status = std::process::Command::new("cargo") + .args(["zola", "build"]) .status() .unwrap(); assert!(status.success(), "failed to build site");