SOLVED: Liquid Exception: undefined method `split' for nil:NilClass in /_layouts/post.html

My public repository: GitHub - verity-s/verity-s.github.io: Enables / disables WiFi networks on T-Mobile home internet Arcadyan KVD21 gateway

Build fails with this error, and I have no idea what is going on. The post.html contents:

---
layout: base
---

<section>
  <br />
  {{ content }}  
  <h1>
    Latest posts
  </h1>
  <ul>
    {% for post in site.posts %}
      <h2><a href="{{ post.url }}">{{ post.title | escape }}</a>
      </h2>
      <h6>
      <span>
        {{ post.date | date_to_string }} &bull;
        {% assign words = post.content | number_of_words %}
        {% if words < 360 %}
          1 min read
        {% else %}
          {{ words | divided_by:180 }} min read
        {% endif %}
      </span>
      </h6>
      {{ post.excerpt }}
    {% endfor %}
  </ul>
</section>

I further edited the post.html to try and change the post date format to YYYY-MM-DD, adding to _config.yml:
date_format: "%Y-%m-%d"
And then I hope to have in post.html:
{{ post.date | date: site.date_format | date_to_string }} &bull;
But no, same exact Liquid error. Any guidance is appreciated!

It feels like it took me forever to have a lightbulb moment about this. To any other beginner in the future: inside a post.html, the post date is page.date (and similarly, it’s page.content and so on) but inside my default.html list of posts and their dates are post.date (and correspondingly post.content). I was missing that distinction and the build was not finding the correct values. Pfew.

Still not sure what the logic is of this difference.

when you loop over things you can use any word/string as the item descriptor (not sure what this is actually called - iterator maybe) so in your code above it says for post in.. the post can be whatever you want, normally people use a word that descibes what the thing is (a post) - I usually use item - like for item in site.posts and then it is item.title or whatever.

When you you are on a page and not in a loop then you use page - like page.title.

I had the same issue originally thinking post.whatever was a thing when it isn’t - unless you are inside a loop and it said for post in.....

Thank you, that is very helpful!