Need to schedule dynamic page content release

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.

Can anyone point me in the right direction?

I don’t think you have to use Job Scheduler for that.
But I’ll need more details about these dynamic pages and the database collection structure.

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…)

Is this helpful?

@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).

Thx again for the help and knowledge!

@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:

//in backend/data.js
function getItemWithDates(item){
const dates = {
  '1':{
    start: new Date('March 17, 2022 05:30:00'),
    end: new Date('March 18, 2022 05:30:00'),
},
  '2':{
    start: new Date('March 20, 2022 05:30:00'),
    end: new Date('March 30, 2022 05:30:00')
},
//etc..
};
if((item.startDate && item.expirationDate) || !item.numberId){return item;}
const numStr = item.numberId.toTring();
item.startDate = dates[numStr].start;
 item.expirationDate = dates[numStr].end;
return item;
}

const  collection1_beforeInsert = (item)  => getItemWithDates(item);
const  collection1_beforeUpdate = (item)  => getItemWithDates(item);
const  collection2_beforeInsert = (item)  => getItemWithDates(item);
const  collection2_beforeUpdate = (item)  => getItemWithDates(item);

P.S. the dates in the function above are based on UTC timezone (I think).