Fixing Jekyll YAML and File Errors | Generated by AI
The output you’ve provided shows two types of errors:
-
YAML Exception: This indicates an issue with the front matter (the YAML block at the top) of your Markdown files:
/Users/lzwjava/projects/lzwjava.github.io/notes/2025-06-25-company-valuation-comparison-en.md
/Users/lzwjava/projects/lzwjava.github.io/notes/2025-06-25-top-companies-evolve-en.md
The error “did not find expected key while parsing a block mapping at line 2 column 1” suggests that the YAML syntax in these files is incorrect, likely missing a key or having an indentation issue in the front matter.
-
Errno::ENOENT: No such file or directory @ rb_sysopen - /Users/lzwjava/projects/lzwjava.github.io/wandb/debug-internal.log
: This error indicates that Jekyll is trying to access a file or directory that doesn’t exist, specifically/wandb/debug-internal.log
. This could be a temporary file or a dependency from another tool (like Weights & Biases -wandb
) that Jekyll is trying to process.
To answer your question on how to let Jekyll ignore some directories, you can use the exclude
option in your _config.yml
file.
Here’s how to do it:
-
Open your
_config.yml
file (located in the root of your Jekyll project). -
Add or modify the
exclude
directive. This directive takes an array of paths (files or directories) that Jekyll should ignore during its build process.For example, to ignore the
wandb
directory and any other directories you want to exclude, add the following to your_config.yml
:exclude: - wandb/ - some_other_directory/ - another_file_to_ignore.md
Important Notes:
- Make sure to include the trailing slash (
/
) for directories to ensure all content within them is ignored. - Paths are relative to the root of your Jekyll project.
- Make sure to include the trailing slash (
Addressing your specific errors with exclude
:
-
For the
wandb
directory error: Addingwandb/
to yourexclude
list in_config.yml
should prevent Jekyll from trying to read files within it, resolving theNo such file or directory
error forwandb/debug-internal.log
. -
For the YAML Exception: The
exclude
directive will not fix the YAML errors in your Markdown files. You need to manually correct the front matter innotes/2025-06-25-company-valuation-comparison-en.md
andnotes/2025-06-25-top-companies-evolve-en.md
.Typical Jekyll Front Matter Structure:
--- layout: post title: "My Awesome Post" date: 2025-07-02 10:00:00 +0800 categories: [notes, tech] tags: [jekyll, markdown] --- Your content goes here.
Double-check the files mentioned in the YAML Exception to ensure they follow this structure, especially concerning indentation and correct key-value pairs. The error “did not find expected key while parsing a block mapping at line 2 column 1” suggests that something is amiss right at the beginning of your front matter, possibly a missing key or an extra space where a key should be.
After making these changes to your _config.yml
and correcting your Markdown files, try running your Jekyll build or serve command again.