Stack level too deep - amp-jekyll

I am using minimal-mistakes theme. I am trying to install amp-jekyll plugin. When I try to bundle exec jekyll serve, it gives this error:

Liquid Exception: stack level too deep in /_layouts/default.html
------------------------------------------------
Jekyll 4.0.0 Please append --trace to the serve command
for any additional information or backtrace.
------------------------------------------------

/_layouts/default.html

<html lang="{{ site.locale | slice: 0,2 | default: "en" }}" class="no-js">
  <head>
    {% include head.html %}
    {% include head/custom.html %}
  </head>

  <body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}">

    {% include browser-upgrade.html %}
    {% include masthead.html %}

    <div class="initial-content">
      {{ content }}
    </div>

    {% if site.search == true %}
      <div class="search-content">
        {% include search_form.html %}
      </div>
    {% endif %}

    <div class="page__footer">
      <footer>
        {% include footer/custom.html %}
        {% include footer.html %}
      </footer>
    </div>

    {% include scripts.html %}

  </body>
</html>

I also had the “stack level too deep” error a while ago. Unfortunately I can’t remember the details; I loosely recall it was a structural error, certainly on my side.

Here, if you have not tested that already, is it possible that you have a circular include somewhere? Removing most of your lines and then slowly adding back might isolate the problem to one of the xx.html includes. Good luck!

1 Like

Hi, thanks for the answer. I found the problem and solved it. But one more thing, it cannot render markdown. Thanks again.