With the new duplicate page action, it’s quite nice to be able to create a template of a page and duplicate it.
However, there is an issue with this approach. Sometimes you will want to pass information to the new page. For example:
- In a customer wiki that contains information about your customer, you’ll want to pass the customer name
- In a meeting doc, you’ll want to pass the current date (if you have a new page for each meeting)
This doc offers a (dirty hacky) solution to that problem.
Overview
The only information we can pass to the new page upon duplication is the name of the page.
Then we need a way to get the information out of the page title.
Here’s the doc for you to look at, below is a summary of all the tricks that were used.
1. Create a Button on your Template Page
This can be any button, it’s used to get the url of the page, but it’s nice if it does something. In this case, the button creates the new meeting.
2. Create thisPage
formula
[yourButton].Url()
This is what we’ll extract the title of the page from.
3. Get thisMeetingDate
Now, create another formula called thisMeetingDate
. It looks like this:
thisPage.ToText().Split("/").Last().Split("_").First().ToDate()
This formula extracts the date part of the url.
If the url is: https://coda.io/d/_dV-vk_8iWzc/Meeting-Template_su55M
- Convert it to text
- Split it along forward slashes “/”
- Grab the last bit
Meeting-Template_su55M
- Grab the first part
- Convert it to a date
4. Create the New Doc Button
Under Action make sure to pass in the current date as the name of the new page:
DuplicatePage([Meeting Template], Today())
Done!
That’s basically all there is to it! You’ll notice the actual doc has a bit more to it, but that’s just so that it’s useful, this information covers the heart of what’s needed.
Doc is also published here:
https://coda.io/@connor-mccormick/simple-meeting-doc