Generator inside a generated page? #648
Answered
by
oscarotero
writeblankspace
asked this question in
Q&A
-
I used a generator to make a page for each tag in my blog: // tags/index.page.js
export const layout = "layouts/tagList.vto";
export const title = "Tags";
export const category = "list";
export default function* ({ search }) {
// config
const baseURL = "/tags"
// set args
const tags = search.values("tags");
// yield the index
yield {
url: `${baseURL}/`,
layout: layout,
title: title,
category: category,
tagArr: tags
}
for (const tag of tags) {
const page = {
url: `${baseURL}/${tag}/`,
title: `#${tag}`,
layout: "layouts/tagPage.vto",
tag: tag
};
yield page;
}
} Each tag page contains a list of pages that contain that tag: {{#- _includes/layouts/tagPage.vto -#}}
<section>
{{ for page of search.pages(tag, "date=desc") }}
{{#- page stuff here -#}}
<hr class="sep">
{{ /for }}
</section> Is it possible to give each tag page pagination? |
Beta Was this translation helpful? Give feedback.
Answered by
oscarotero
Aug 13, 2024
Replies: 1 comment 3 replies
-
You can use a different generator to paginate the first pages using renderOrder to make sure the render order is correct. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
writeblankspace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use a different generator to paginate the first pages using renderOrder to make sure the render order is correct.