Skip to content

Trying to use pagination with 11ty.js template...not succeeding #3082

Answered by bobmonsour
bobmonsour asked this question in Q&A
Discussion options

You must be logged in to vote

With the help of an able-bodied helper on the Discord server, my problem has been solved. Here is the code in working form. I learned a lot.

// Create json files for the listed set of categories
// Files are created in the /api folder off the root of the site
// The file name is the category name in kebab case
const _ = require("lodash");

const sourceData = require("../_data/allrecords.json");

class MyJsonFiles {
  data() {
    return {
      pagination: {
        data: "categories",
        size: 1,
        alias: "category",
      },
      // These are the categories that generate json files in the api directory
      categories: ["Getting Started", "CMS"],
      permalink: (data) => `…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by bobmonsour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant