zola: [next] zola serve works but zola build fails

Bug Report

Environment

Zola version: next branch (commit d356a76a012d0ab56c4997c0584f6e53e82de66f)

Expected Behavior

The website should build.

Current Behavior

The website builds when running zola serve but fails when running zola build with the following message:

-> Creating 8 pages (3 orphan), 4 sections, and processing 0 images
Failed to build the site
Error: Failed to render single term skills page.
Reason: Failed to render 'squat/templates/skills/single.html'
Reason: Page `_common/skills/html5.md` not found.

Steps to reproduce

The source to the website can be found here.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (3 by maintainers)

Most upvoted comments

Looking at Hugo/Jekyll, they both have a --drafts or --buildDrafts flag for the build & serve. I don’t really see the point of a zola build --drafts if anyone can explain it.

@ozkxr I would prefer a specific flag like --drafts

I would like to add a third option which zola serve render draft by default but a flag is added to exclude the rendering of the drafts.

EG: zola serve renders everything including drafts zola serve --exclude-drafts renders everything excluding drafts

I personally flavor this option.

Personally I would like draft pages to be excluded from zola serve (to be consistent with zola build) unless a parameter is passed in to particularly enable draft pages 😃

Woops, sorry i copied the wrong diff.

components/templates/src/global_fns/mod.rs
         match library.get_page(&full_path) {
             Some(p) => Ok(to_value(p.to_serialized(&library)).unwrap()),
-            None => Err(format!("Page `{}` not found.", path).into()),
+            None => {
+                match full_path.exists() {
+                    true => Err(format!("Page `{}` exists but has not been load
ed. If it's a draft, remember draft pages are not loaded when running the `build
` command.", path).into()),
+                    false => Err(format!("Page `{}` not found.", path).into())
+                }
+            },
         }