Dump all Jekyll variables for debugging


I recently had a nightmare figuring out that Jekyll custom collections cannot be named documents. Sigh.

The following snippet helped diagnose the problem:


<pre id="jekyll-debug"></pre>
<script>
  var obj = JSON.parse(decodeURIComponent("{{ site | jsonify | url_encode }}"));
  var prettyJson = JSON.stringify(obj, null, 4);  // Pretty-printed JSON (indented 4 spaces).
  document.getElementById("jekyll-debug").textContent = prettyJson;
</script>

Live example for this website!


Credit to Flux on StackOverflow

Date: 2022-04-23

Tags:  jekyll

Share: