How can I get all type of error from all the files?

#Jekyll MD File Failures

I utilize Jekyll to convert Markdown (MD) files to HTML.

I have a total of 100 MD files in a folder. If my third file encounters a syntax error while executing the Jekyll build command, the compilation process get stopped.

How can I obtain information about the failures that occurred in all the MD files?

Can you share an example of a file that is causing a failure?

Hi BillRaymond,

Please find the example below.

File 1 : There is no errors


File 2 : language missed in highlight tag


File 3 : tag name is wrong


My requirement is have to get the both failure (file 2 and file 3) in single shot.

I see. So the issue is you want to be informed of all the errors so you can handle them rather than waiting for a build to complete, correct?

If you can run bundle exec jekyll serve —live reload then it will require a successful build with no errors, but after that it will warn me of errors and keep trying to run. That said I think you are saying the errors are already there.

I have never tried this, but I do know there is a —profile option you could use with the command line. I’m not really familiar with it, but maybe give it a shot?

Here’s the link:

This article has an idea that perhaps works, but once again I have not tried it:

I suppose a few other options would be to see if there’s a plug-in or create a script that runs some tests.

Perhaps others here have some thoughts on how to address the issue, but at this moment, I’m not sure if I have anything more for you.

Hi @BillRaymond ,

I see. So the issue is you want to be informed of all the errors so you can handle them rather than waiting for a build to complete, correct?

Ans for the above questing is NO.

Here my clear requirement,

I am running Jekyll build in cmd. if my 2nd MD file having issue, cmd get stopped and showing the issues of 2nd file.

Then I will run Jekyll build again. Then it will show the errors of 3rd file.

Instead of above to step, I need to get the 2nd and 3rd file errors in single shot.

I just need to get all the errors by running any command.

Poovarasan K

Try creating the _plugins/check.rb file and put the following inside :

module Jekyll
  class Site
    def render_errors
      @render_errors ||= []

    def render_pages(payload)
      pages.each do |page|
        render_regenerated(page, payload)
      rescue => e
        render_errors.push e
      render_errors.each do |err|
        puts err.inspect
        Jekyll.logger.debug err.backtrace
        Jekyll.logger.debug "==========\n\n" 
      raise "Error rendering site" if render_errors.length > 0

This is quite hacky, as I just came up with this, but it should give you a good starting point. I’ve tested this with a very simple project, containing only the plugin and two markdown files that use the {% include ... %} tag to produce rendering errors. bundle exec jekyll serve reports both errors when I use the plugin. You will be able to display the full trace for each error by using the -V (verbose flag) with your Jekyll command.

This simply overrides the render_pages method of the Jekyll::Site class to continue the loop in case an exception happens. We also add an instance variable to hold the list of all exceptions that happened during the rendering process.
We then report on all exceptions once the loop is over, and raise a new exception if at least one page produced an error. Here is the original render_page method (from Jekyll’s github repo) for reference :

def render_pages(payload)
  pages.each do |page|
    render_regenerated(page, payload)

Hello @pcouy,

I would like to express my gratitude for providing the plugin. It is functioning well and meets my requirements. However, I am currently encountering an issue.

When my MD files contain multiple syntax errors, the plugin only displays the first syntax error from each file. I am currently investigating how to resolve this matter.

Would you be able to offer any suggestions or ideas?

Best regards,
Poovarasan K

While it is easy to ignore a rendering error for a page a move on to the next page, I’m afraid there is no easy way to do what you are asking.

Liquid, like any template engine, is very close to a regular programming language (it has variables, conditionals, loops, etc.). Every page is like it’s own program that gets interpreted to produce the corresponding output file.

Let’s say you use a conditional to check if a variable is a number, and do some number related things with your variable if it is (stuff that would be invalid to do with any other type, such as comparing it with another number)

What if you have a syntax error in the conditional? The interpreter cannot tell what you intended to check for, and is then given the choice between :

  • Always skipping what’s inside the conditional (but then what if there is an else case, do we skip it as well?)
  • Always entering the condition, potentially producing errors that would not happen if the if tag did not have syntax error in the first place (what happens if there is an else ?)
  • Stop processing the file immediately and report the error

If you look at any programming language, it is generally not possible to keep the execution going after an error happens, and you always have to fix the reported error so that the interpreter can find the next error.

If my answer meets your requirements, can you mark the thread as solved please?

When running the Jekyll build command, any syntax errors encountered in the Markdown files will cause the compilation process to halt. To obtain information about failures in all the MD files, you can use a loop or a script to iterate over each file and handle the errors individually. Here’s a general approach:

  1. Iterate Over MD Files: Write a script or use a loop (depending on your preferred programming language) to iterate over each Markdown file in the folder.
  2. Execute Jekyll Build Command: For each file, execute the Jekyll build command individually, passing the file as an argument. This way, even if one file encounters an error, it won’t stop the process for the remaining files.
  3. Capture and Log Errors: After executing the Jekyll build command for each file, capture any error messages or output generated by the process. You can redirect the error messages to a log file or store them in a data structure for further processing.

Here’s a simple example using Bash scripting:

bashCopy code



for file in path/to/md/files/*.md; do
  jekyll build "$file" 2>> "$log_file"

In this example, replace "path/to/md/files/*.md" with the actual path to your Markdown files. The 2>> notation redirects the error messages (stream 2) to the specified log file (error_log.txt).

After running this script, you can examine the error_log.txt file to see the syntax errors encountered during the Jekyll build process for each file. This approach allows you to obtain information about failures in all the MD files without the compilation process getting stopped by a single error.

Note that you can adapt this approach to your preferred programming language if you’d like to handle the process differently or incorporate additional logic.

Hi @hassanizhar ,

Thanks for your suggestion.

But I have already tried this way. But we could not build the single file using Jekyll.

Please find the reference below.


Please let me know any other suggestions.

Poovarasan K

Please do not use ChatGPT as a reference. While in this case, it seems to be telling the truth, ChatGPT is NOT a reliable source for anything factual.
One small other thing is that you should never post text as a screenshot. This can be very annoying to read on different screen sizes, does not get indexed by search engines, and does not let us copy-paste from it.

Besides, you marked your own message which does not solve the issue as a solution to the thread…