{{page.category}} and schema error

Hi. I am using the code below to show breadcrumbs schema on a Github pages site. But after adding a custom domain, the {{page.category}} appears blank in both the URL and the name. I am not sure why this is happening. Could anyone have an idea why? (I am new to Github pages).
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"{{ site.url }}","name":"{{ site.title }}"}},{"@type":"ListItem","position":2,"item":{"@id":"{{ site.url }}/category/{{page.category|downcase}}/","name":"{{page.category}}"}},{"@type":"ListItem","position":3,"item":{"@id":"{{ site.url }}{{ page.url }}","name":"{{ page.title }}"}}]}

NB: {{post.category}} and {{category}} also not working.