Skip to content

cook build web: search-index.js changes on every build of an unchanged collection #806

Closed

Description

@LeMyst

cook build web doesn't write the same site twice for the same collection: static/search-index.js comes out with its entries in a different order on every run. So a static site published through git, rsync or a CI deploy always has a change to ship, even when nothing changed.

To reproduce: build the seed twice into two folders and compare them.

cook build web --base-path seed /tmp/a
cook build web --base-path seed /tmp/b
diff -rq /tmp/a /tmp/b

Only static/search-index.js differs: same entries, different order. Everything else is stable, including --sitemap and --feed output.

The index is built by walking the recipe tree (src/build/index.rs), whose children are a HashMap, so the order depends on the hash seed of each run. The sitemap (src/build/sitemap.rs) already sorts its entries by path for this reason. This has been there since the static-site generator came in, in f6703df (#344).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions