I’ve been playing with the jobs config, but not sure if that is the path to take for this. Looking for a simple solution, the scheduler seemed promising, but my coding skill is limited…for now.
We have 12 dynamic pages, and would like to schedule each one to become available over a 12 week period of time, in order, one per week. Once the 12 week period ends, the pages are locked out, then the process begins at a new set time.
It’s a basic test right now. 3 fields: Title (text), Explainer (URL), Review (rich text).
Navigation is set up using a vertical side section with a repeater, and those “buttons” are populated/linked to the “Title” item in the dataset (i.e. Week 1, Week 2…)
@nathanwallrus are all the relevant dynamic pages based on this collection? Is the it based on the _id field, title field?
If the pages are based on this collection.
you can add startTime and expirationTime (type date&time) to the collection.
Put the relevant dates there.
Now, go to your backend files.
Create (if not already exists) a file named routers.js.
and do something like that (for the sake of the example, let’s say the page name is ‘art’):
// In backend/routers.js
export function art_customizeQuery(request, route, query) {
const now = new Date();
return query.le('startDate', now).gt('expirationDate', now);
}
@jonatandor35 Oh thank you for that. I will play with it and see what I can get.
I think I understand what you are saying about _id, title field, etc. And yes, the pages are based on that collection. So it seems straightforward.
Ultimately, I will have 4 versions of these dynamic page collections. So I’m assuming I can just duplicate the database each time, and replace the content? Or is there a smarter way to use the startTime and expirationTime functions to control all 4 databases together ?(since they will always be in time sync, in terms of the content “dripping” available for users each week).
@nathanwallrus you can add a column named numberId.
In each collection fill in the number in the order you wish them to be available: 1,2,3,4,etc…
You can go to the backend/data.js
And create there an beforeInsert and beforeUpdate hooks that update the startDate and expirationDate based on the numberId value like: