Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to render pages, paginator.pages not found in context #2

Open
zmitchell opened this issue Mar 17, 2018 · 6 comments
Open

Fails to render pages, paginator.pages not found in context #2

zmitchell opened this issue Mar 17, 2018 · 6 comments

Comments

@zmitchell
Copy link

zmitchell commented Mar 17, 2018

I put two posts in the content directory and got the following error:

Error: Failed to render section ''
Reason: Failed to render 'after-dark/templates/index.html'
Reason: Variable `paginator.pages` not found in context while rendering 'after-dark/templates/index.html'

That's literally all I've done, so maybe there are extra steps to get things up and running that I'm not aware of.

@Keats
Copy link
Collaborator

Keats commented Mar 18, 2018

I forgot in the README to mention this is a theme meant for paginated content >_>, I just added:

This theme requires your index section (`content/_index.md`) to be paginated to work:

paginate_by = 5

The posts should therefore be in directly under the `content` folder.

to it.

@happysalada
Copy link

I added the paginate_by = 5 in the config.toml
just added one post, keeping the default of the meta data. I still get the same error.
Anything I might have forgotten?

this is how my config.toml looks

# The URL the site will be built for
base_url = "https://megzari.com"

# Whether to automatically compile all Sass files in the sass directory
compile_sass = true

# Whether to do syntax highlighting
# Theme can be customised by setting the `highlight_theme` variable to a theme supported by Gutenberg
highlight_code = true

# Whether to build a search index to be used later on by a JavaScript library
build_search_index = true

paginate_by = 5
theme = "after-dark"
taxonomies = [
    # You can enable/disable RSS
    {name = "categories", rss = true},
    {name = "tags", rss = true},
]
after_dark_menu = [
    {url = "$BASE_URL", name = "Home"},
    {url = "$BASE_URL/categories", name = "Categories"},
    {url = "$BASE_URL/tags", name = "Tags"},
]

[extra]

and this is how my post looks

+++
title = ""
description = ""

# The date of the post.
# 2 formats are allowed: YYYY-MM-DD (2012-10-02) and RFC3339 (2002-10-02T15:00:00Z)
# Do not wrap dates in quotes, the line below only indicates that there is no default date.
# If the section variable `sort_by` is set to `date`, then any page that lacks a `date`
# will not be rendered.
date = 2018-11-11

# The weight as defined in the Section page
# If the section variable `sort_by` is set to `weight`, then any page that lacks a `weight`
# will not be rendered.
weight = 0

# A draft page will not be present in prev/next pagination
draft = false

# If filled, it will use that slug instead of the filename to make up the URL
# It will still use the section path though
# slug = "first_post"

# The path the content will appear at
# If set, it cannot be an empty string and will override both `slug` and the filename.
# The sections' path won't be used.
# It should not start with a `/` and the slash will be removed if it does
# path = ""

# Use aliases if you are moving content but want to redirect previous URLs to the
# current one. This takes an array of path, not URLs.
aliases = []

# Whether the page should be in the search index. This is only used if
# `build_search_index` is set to true in the config and the parent section
# hasn't set `in_search_index` to false in its front-matter
in_search_index = true

# Template to use to render this page
template = "page.html"

# The taxonomies for that page. The keys need to be the same as the taxonomies
# name configured in `config.toml` and the values an array of String like
# tags = ["rust", "web"]
[taxonomies]

# Your own data
[extra]
+++

Some content

@Keats
Copy link
Collaborator

Keats commented Nov 12, 2018

paginate_by = 5 is not meant to be in config.toml, it should be in your _index.md file like https://github.com/getzola/after-dark/blob/master/content/_index.md

@happysalada
Copy link

ok I tried to look into that contents directory and render just that.
I put a some_article.md file with

+++
title = "What is Gutenberg"
date = 2017-09-24
[taxonomies]
categories = ["Hello world"]
+++

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc eu feugiat sapien. Aenean ligula nunc, laoreet id sem in, interdum bibendum felis. Donec vel dui neque. Praesent ac sem ut justo volutpat rutrum a imperdiet tellus. Nam lobortis massa non hendrerit hendrerit. Vivamus porttitor dignissim turpis, eget aliquam urna tincidunt non. Aliquam et fringilla turpis. Nullam eros est, eleifend in ornare sed, hendrerit eget est. Aliquam tellus felis, suscipit vitae ex vel, fringilla tempus massa. Nulla facilisi. Pellentesque lobortis consequat lectus. Maecenas ac libero elit.

Ut luctus dolor ut tortor hendrerit, sed hendrerit augue scelerisque. Suspendisse quis sodales dui, at tempus ante. Nulla at tempor metus. Aliquam vitae rutrum diam. Curabitur iaculis massa dui, quis varius nulla finibus a. Praesent eu blandit justo. Suspendisse pharetra, arcu in rhoncus rutrum, magna magna viverra erat, eget vestibulum enim tellus id dui. Nunc vel dui et arcu posuere maximus. Mauris quam quam, bibendum sed libero nec, tempus hendrerit arcu. Suspendisse sed gravida orci. Fusce tempor arcu ac est pretium porttitor. Aenean consequat risus venenatis sem aliquam, at sollicitudin nulla semper. Aenean bibendum cursus hendrerit. Nulla congue urna nec finibus bibendum. Donec porta tincidunt ligula non ultricies.

Sed vulputate tristique elit, eget pharetra elit sodales sed. Proin dignissim ipsum lorem, at porta eros malesuada sed. Proin tristique eros eu quam ornare, suscipit luctus mauris lobortis. Phasellus ut placerat enim. Donec egestas faucibus maximus. Nam quis efficitur eros. Cras tincidunt, lacus ac pretium porta, dui dolor varius elit, eget laoreet justo justo vitae metus. Morbi eget nisi ut ex scelerisque lobortis ut in lorem. Vestibulum et lorem quis ipsum feugiat varius. Mauris nec nulla viverra nisi porttitor efficitur. Morbi vel purus eleifend, finibus erat non, placerat ipsum. Mauris et augue vel nisi volutpat aliquam. Curabitur malesuada tortor est, at condimentum neque eleifend in.

Morbi id ornare lacus. Suspendisse ultrices rutrum posuere. Nullam porttitor libero quis ligula finibus semper. Mauris iaculis magna et nisl tristique, eget maximus ex feugiat. Nam eu felis leo. Quisque ultrices varius purus in molestie. Duis non accumsan ligula. Vivamus dignissim malesuada metus, vel hendrerit tellus viverra id. Curabitur posuere, mauris vitae dignissim dictum, velit mi condimentum lorem, nec varius velit arcu a mi. In dolor sapien, condimentum sed aliquam at, dignissim id purus. Cras lorem leo, vulputate ac ante sed, molestie tempus lectus. Curabitur efficitur libero quam, rhoncus faucibus libero pharetra nec. Curabitur lobortis ullamcorper nisl eu imperdiet. Duis porttitor interdum magna, ac eleifend orci consequat vitae. Aliquam augue felis, faucibus vel blandit sed, maximus non turpis.

Quisque viverra a eros id auctor. Proin id nibh ut nisl dignissim pellentesque et ac mi. Nullam mattis urna quis consequat bibendum. Donec pretium dui elit, a semper purus tristique et. Mauris euismod nisl eu vehicula facilisis. Maecenas facilisis non massa non scelerisque. Integer malesuada cursus erat eu viverra. Duis ligula mi, eleifend vel justo id, laoreet porttitor ex. Etiam ultricies lacus lorem, sed aliquam nulla blandit in. Maecenas vel facilisis neque, vitae fringilla eros. In justo nibh, pellentesque sed faucibus nec, varius sit amet risus.

(note that if the newlines are not respected at the top it won't work)

then I added a _index.md file with

+++

paginate_by = 5

+++

and now it gives me the error

Error: Failed to render pager 1
Reason: Failed to render 'after-dark/templates/index.html': error while rendering macro `post_macros::page_in_list`
Reason: Macro namespace `self` was not found in template `after-dark/templates/index.html`. Have you maybe forgotten to import it, or misspelled it?

did I forget something?

@Keats
Copy link
Collaborator

Keats commented Nov 14, 2018

I think you're running into a bug in gutenberg 0.4.2 there :(
It should work with 0.4.1 or wait a bit as I'll release 0.5.0 this week and will update the themes to ensure they work on 0.5.0 today or tomorrow

@ad-si
Copy link

ad-si commented Feb 10, 2021

paginate_by = 5 is not meant to be in config.toml, it should be in your _index.md file like https://github.com/getzola/after-dark/blob/master/content/_index.md

Just tripped over this. I also put it in the config.toml. This should be clarified in the docs…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants