getzola/even

No default template for sections

zmitchell opened this issue · 6 comments

If I don't specify a template for a section, the site fails to build with the error message:

Reason: Template 'even/templates/section.html' not found

My directory structure is

content/
    posts/
        _index.md
        some_post.md
    about/
        _index.md

but the build fails for any template I use in _index.md because it's missing something i.e. paginator.page, category.name, etc.

Keats commented

Of course I forgot to do the About page >_>

If you check the repo now I've added it in 0b44ffb

Alright, I'm confused. I've pulled the most recent version of the theme and I'm using the exact directory structure as the sample content in the theme:

content/
    pages/
        _index.md
        about.md
    some_post.md
    _index.md

but I'm still getting an error Variable "paginator.pages" not found in context while rendering "even/templates/index.html" when trying to render the _index.md at the root of the contents folder.

Ok, I figured it out. It looks like your paginator doesn't get created if paginate_by = 0, so when you go to iterate over paginator.pages, it freaks out. I got it to work by duplicating that section and wrapping one in if paginator is defined and one in if paginator is undefined. I've never really used templating before, so I'm not sure if there's a more elegant way to do that. Either way, I don't think it's safe to assume that the user wants pagination.

Keats commented

This theme is expecting the main section to be paginated, I should add it to the README.

Edit: it's actually mentioned a bit already. Note that this theme is a port of an existing one, not my own creation

I also just ran into the paginator.pages issue.

Itanq commented

Alright, I'm confused. I've pulled the most recent version of the theme and I'm using the exact directory structure as the sample content in the theme:

content/
    pages/
        _index.md
        about.md
    some_post.md
    _index.md

but I'm still getting an error Variable "paginator.pages" not found in context while rendering "even/templates/index.html" when trying to render the _index.md at the root of the contents folder.

Hi @zmitchell I have already set the paginate_by = 5, But I still get the error "Reason: Variable paginator.pages not found in context while rendering 'even/templates/index.html'", you solved the issue?