Hugo

Is there currently a way to do pagnation for data objects?

I’m just reading from a json file and wondering if I can handle pagination with Data objects?

today no way.
You can create different .md files and filter your data file…

1 Like

Okay I’ll do that, realistically how many objects is too many if I go with a .md route? Would pagination be okay for thousands of entries?

Yes.

  1. Who can realistically read that much?!

My point being, no one is going to visit your thousands of paginated posts. They’ll search and find the thing they want. So be creative, keep pagination low, add a search bar to every page. :sunglasses:

My blog currently has about 2100 posts. (15 years worth of uninteresting stuff). I regularly find people using the pagination to read for around 4 hours up to 500 posts. Visitors grow tired :wink:

The real question I had when reading your original topic was: What are you doing to have a huge data file that requires pagination. Maybe the proper approach would be to somehow change the creation process of that data file into something that creates proper .md files and then use a search service like Algolia (free for 10k items I think) to do the search?

I’m generating data and need to have users view and rate it.
I might have another option that may work and please tell me if this is possible, I need a user to rate the data on a scale, am I able to organize the items position in pagination to display <0 voted posts first once I rebuild the static site with the values? I’m thinking of just adding a slider that adds its value to a database of these items then every day rebuilding the site with these updates.

This might be a task for staticman.net - I am playing around trying to create my comment system with an own instance. It seems that you can change .md files too using static man, some even try doing a forum system on it. It’s complicated to setup though. If you export your data into .md files and a section structure you have pagination. then integrating something like a form where you can edit data in the front matter of each post that then sends the changes via staticman to a branch in your repo. this way you can even deal with spam/edit errors.

But like I said: that might need an expert, I am one week in and still did not get my comments running :smiley:

@pkollitsch Does SM allow custom fields? Or are you stuck with their template (movie reviews)?

That’s just a sample. you can do any arbitrary field you want. You define in the configuration what fields you expect, all else is ignored.

1 Like