Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 549 Bytes

change_title.md

File metadata and controls

26 lines (21 loc) · 549 Bytes

Change title

The following code update the page title.

Pattern 1 (replace existing text partially)

page = Page.find page_id # API access
print page.title # -> ABC\nDEF
tp = page.properties["Title"]
tp[1].text = "GHI"
page.save # API access
print page.title # -> ABC\nGHI

Pattern 2 (replace all text)

page = Page.new id: page_id, assign: [TitleProperty, "Title"]
tp = page.properties["Title"]
tp << TextObject.new("JKL")
page.save # API access
print page.title # -> JKL

Return to README.md