2.0.0-canary.21 in dev mode: permalinks and collections
See original GitHub issueOperating system
macOS Ventura v.13.1 (22C65)
Eleventy
2.0.0-canary.21
Describe the bug
With Eleventy 2.0.0-canary.20, the following file…
https://github.com/brycewray/eleventy_site/blob/main/_data/eleventyComputed.js
… controls whether files have permalinks and appear in collections based on their timestamps and draft
status, as I described in https://www.brycewray.com/posts/2022/12/drafts-timestamp-based-publishing-eleventy/ (earlier today). This doesn’t work fully in dev mode when --incremental
is in use; it adjusts some pages but not others. I had hoped that 2.0.0-canary.21 would correct this, but I’ve found that, instead, it doesn’t work in 2.0.0-canary.21 at all, and that’s with or without --incremental
. Reverting to 2.0.0-canary.20 solved the issue, but still only if --incremental
is not part of the Eleventy command.
Reproduction steps
- Install Eleventy 2.0.0-canary.20.
- Add a JavaScript file to the site data directory which uses
eleventyComputed
(as described above) to control whether files are built and appear in collections, based on theirdraft
status and timestamps within their respective front matter. - In dev mode, run
ELEVENTY_ENV=development npx @11ty/eleventy --serve
. In 2.0.0-canary.20, the site respects the item from step 2. (For example: change an existing Markdown file’s timestamp to a future date and/or itsdraft
status totrue
, and this should hide it by killing its permalink and removing it from collections; then revert these changes and the file should reappear.) - Still in dev mode, run
ELEVENTY_ENV=development npx @11ty/eleventy --serve --incremental
. In 2.0.0-canary.20, the site doesn’t uniformly respect the item from step 2. - Repeat step 3 and confirm that all again works as it should in 2.0.0-canary.20.
- Install Eleventy 2.0.0-canary.21.
- Repeat step 3. In 2.0.0-canary.21, the site doesn’t respect the item from step 2. (The parenthetical test example in step 3 doesn’t work.)
- Repeat step 4. In 2.0.0-canary.21, the site doesn’t respect the item from step 2. (The parenthetical test example in step 3 doesn’t work.)
Expected behavior
With or without --incremental
in place, files should get permalinks and be in collections — or not — based on how the eleventyComputed
evaluation goes. (But, even if --incremental
remains problematic for the 2.0.0 canaries, the desired behavior absolutely should occur when that switch is not used.)
Reproduction URL
https://github.com/brycewray/eleventy_site
Screenshots
No response
Issue Analytics
- State:
- Created 9 months ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Ah, yeah I found two regressions here, one in non
--incremental
builds using a template cache that they weren’t supposed to. Fixed with https://github.com/11ty/eleventy/commit/e4501e8d7e549c42df8d3de00a8d9ba37ba7c303And more controversially, during
--incremental
: whether or not the cached data cascade should be used for non-matching templates. I did a commit to reset the cache for the data cascade in this scenario, I think it should likely fix your problem. https://github.com/11ty/eleventy/commit/01c1cf2160a47e1a2dbf968f3cca5e31b47d4bb1Shipping with v2.0.0-canary.22
@zachleat In case you wanted me to test 2.0.0-canary.23 as well: be advised that I just loaded it and saw the same behavior as in canary.20 and canary.22 re
--incremental
. Let me know if you want me to try anything else. In any event, certainly just a small concern and absolutely not worth losing any of your holidays-related time worrying about IMHO. 🎄 👪