pagehive

put_page

Create or replace one page in the draft.

Draft contentChanges dataAll plans

What it does

Create or replace one page in the draft. Visitors do not see it until publish_site. Omit source to leave the template. Omit page_css to leave that page's stylesheet. null or "" removes it. Creating a page requires source. Send at least one of source, page_css, title, or settings. If the files, title, and settings match the current draft, nothing is written and the response is the current version with noop true. version.live is true when that version is the one visitors currently see. The HTML is the page; a script only enhances it. Liquid output inside an inline script, an on* attribute, script src, base href, iframe srcdoc or an unquoted attribute is refused; scripts belong in /scripts files, with values passed in data-* attributes. patch_page changes part of a page. Pages load live public data with <script src="/_pagehive/bp.js"></script> and bp.query. Page and template reference: https://pagehive.io/docs/bot-guide.md (section Pages and partials).

Plans

Works on every plan: Free, Basic, Pro and Ultra.

Parameters

NameTypeAbout
site_idrequiredstringThe id of the site. list_sites gives the ids of your sites.
pathrequiredstringThe page's address on the site, such as / or /about.
titlestringThe page title, used when the template doesn't set its own.
sourcestringThe full page template: HTML with Liquid, optionally starting with a data block between --- lines.
settingsobjectdescription, and og: { title, description, image, image_alt, site_name, url, type } for link previews. A /path image or url becomes a full address. With no image the Pagehive card shows; image "none" shows none.
page_cssstring or nullCSS for this page only. null removes it.
messagestringA short note for the version history, like a commit message.
verbosebooleantrue lists every file and page of the draft. Otherwise the response lists only what this call changed, plus draft totals.

Example

Call put_page with these arguments:

{
  "site_id": "01a1…",
  "path": "/about",
  "title": "About",
  "source": "<!doctype html><html><body>{% include 'header' %}<h1>About us</h1></body></html>"
}

Ids like 01a1… stand for your own. list_sites and list_tables give you the real ones.

Related guides