docs
/
AI skills

Copy a page as a template

A new page made from an existing one — every screen, its page CSS and JavaScript — at its own name and URL, ready to change, with the original left exactly as it was.

Use this when a new page should start from one the business already has: a second landing page, a page per service, a page per location. Build Studio has no Duplicate button, so the copy is made from the record.

Ask first

  • Which page is the source? By its URL or name. Confirm it is the one that renders at that URL (step 1).
  • The new page's URL and title, and which site it goes on if not the same one.
  • What changes in the copy? The headline, the text, the images, a product category, a form. Everything else stays as it is.
  • Should the copy be visible right away? On a site that serves drafts, it is live from the moment it is created.

Steps

1. Build Studio: read the source page

Find it with repo_find on page ({ "data.site": "<site>", "data.name": "<name>" }, or by slug), then read the full record with repo_find_one on page and its id. A find result is partial and has no style.

What a copy carries:

PartWhere
The page's contentdata.screens[] (each a full HTML document, with its variants and animations in config), data.activeScreenId, and data.html (the mirror)
Page CSS / JavaScriptthe top-level style (css, javascript, styleLinks, scriptLinks)
SEO and social blockthe top-level post, if there is one
Its wrapperdata.parent, if it has one
Page data settingsdata.initData, data.datatype, if set

If the source has no screens but a non-empty data.content or data.sections, it is an older-format page. Copying works, but the copy is in the same older format; say so, and offer Build a website page for a fresh one instead.

Hands on: the full source record. Check: the record has screens (or html) with the content you see on the site, and style at the top level if the page has code.

2. Site settings: a free URL for the copy

Check the new slug and name as in Build a website page step 1: not a built-in or feature URL, not starting with sitemap, assets or tt, and no page on the site with that name or slug.

Hands on: the new name and slug. Check: nothing on the site already has them.

Stop: on a site that serves drafts (publishedPagesOnly not true), the copy is live at its URL as soon as it is created. Tell the person the URL and wait for yes.

3. Build Studio: create the copy

Create it in one call so the style comes with it — call_appengine PUT /repository/create:

{
  "datatype": "page",
  "isNew": true,
  "data": { "…every field of the source's data…": "",
            "name": "spring-offer", "slug": "spring-offer",
            "title": "Spring offer", "description": "…" },
  "style": { "…the source's style…": "" },
  "post": { "…the source's post, if any…": "" }
}
  • Send the source's data with only name, slug, title and description changed (and site, to copy to another site). Leave out data.thumbnail; Build Studio makes a new one on the next save.
  • Never send the source's sk, _id, pk, version or dates. They belong to the original.
  • repo_create can't set style. If you use it, follow with page_write on the new id with the source's javascript, css, scriptLinks and styleLinks, and replaceStyle: true.

Answers to expect:

AnswerMeans
200 with the new recordmade; its sk is the copy's id
409 { "reason": "duplicate", "field": "name" }that name is taken on the site; pick another
200 with no recordthe same create was sent twice in a row and the second was dropped as a repeat. Look the copy up by name; don't send it again.

Hands on: the copy's id. Check: repo_find_one on the copy: same number of screens as the source, activeScreenId the same, style.javascript present if the source had it. Read the source again: its name, slug and version are unchanged.

4. Build Studio: change what was asked

Edit the copy, never the source:

  • Text and images: change the active screen's HTML and keep data.html as its mirror — page_write with { "id": "<copy id>", "html": "<new document>" } writes the active screen, then repo_update with patch: { "html": "<same document>" }.
  • A list's filter (a category, a tag): edit the data-source-payload in the HTML.
  • Code that names the page, such as a slug or a page-specific id in style.javascript: replace it with page_write and replaceStyle: true.
  • To another site: links to pages that only exist on the source site, and image URLs, still point where they did. Check each link.

Hands on: nothing new. Check: open the copy in Build Studio at /app/build-studio/<new name>; the canvas shows the changed page. Open both URLs on the site: the copy shows the changes, the source shows none.

Templates from the platform

The page templates Appmint ships (shown when a new site is set up) are copied with call_appengine PUT /repository/create-extended and { "data": { "datatype": "page", "data": { "site": "<site>" } }, "action": "create-page-from-template", "options": { "template": { "templateName": "<template site>", "name": "<template page>" } } }. The copy's name and slug get a random 6-character suffix (landing-page-x7k2qa), so rename it after.

When it's done

Tell the person: the copy's URL and name, what was changed in it, that it carries the source's Page settings code, whether it is already live, and that the source is unchanged. Open the copy in Build Studio and on the site.

What it can't do yet

  • No Duplicate page button in Build Studio. Copies are made through the API.
  • No link between a copy and its source. Changing the source later changes nothing in the copies; a shared part belongs in the shared header and footer or a parent page instead.
  • Template copies get a random suffix on name and slug.

Don'ts

  • Don't copy from a find result; it has no style and the HTML may be cut.
  • Don't send the source's sk, _id or version in the create.
  • Don't write to the source page while changing the copy.
  • Don't make a copy at a URL a built-in page or a site feature owns.
  • Don't resend a create that came back empty; find the copy first.