JavaScript API Class: Site
The Site class is accessible using the "site" implicit object. This class provides access to various site-level functions and properties.
Properties
| Name | Type | Access |
Description |
| adminEmail | String |
read |
The site's administrative email address as specified in Site Management -> General Settings. |
| canCreate | Boolean |
read |
True if the current user has sufficient access to create new pages on the site. |
| canRegister |
Boolean |
read |
True if the site's Registration settings allow for anonymous users to register or request registration as set in Access Controls -> Registration. |
| defaultDomain | String |
read |
The site's default domain as specified in Site Management -> General Settings. |
| description |
String |
read/write |
The value of the Description meta tag set in Site Management -> General Settings. |
| groups |
Array of Groups |
read | Returns an array of all the Groups defined in the site. |
| policies |
Array of Policies |
read |
Returns an array of all the Policies defined in the site. |
| quickEdit |
Boolean |
read/write | True if the Double-click Editing feature is enabled in Site Management -> General Settings. |
| homePage |
String |
read/write |
The name of the default page for this site as set in Site Management -> General Settings. |
| keywords | String |
read/write | The value of the Keywords meta tag set in Site Management -> General Settings. |
| layout |
String |
read/write |
The name of the current layout page for this site as set in Site Settings -> Look & Feel -> Layouts |
| showTools | Boolean |
read/write | True if the site is configured to show the EditMe Tools menu by default. |
| stylesheet |
String |
read/write |
The name of the current style sheet page for this site, as set in Site Settings -> Look & Feel -> Styles |
| timeZone |
String |
read |
Returns the site's default Time Zone. |
| title |
String |
read/write |
The title for this site as set in Site Management -> General Settings. |
| users |
Array of Users |
read | Returns an array of all users in the site. See getUser(String) to get a single user. |
Functions
| Name | Return Type |
Description |
| getPage (String) |
Page |
Returns a Page object for the given name. Use the exists property of the Page class to determine whether the page returned actually exists. NOTE: This method should not be used to make edits that will be saved as the page content is returned already processed. For example [[Links]] will return as links, and will get saved as links, and include tags will be replaced with the included content. Use the getPageForEdit(..) function instead. A future change may raise an exception if save() is called on a page returned by this method. |
| getPage (String, Number) |
Page |
Returns a specified version of the named page. Use the exists property of the Page class to determine whether the page returned actually exists. See note above regarding saving results of this method. |
| getPageForEdit(String, [Version]) | Page | Returns a page without the content processed. For example, [[Links]] and [[include:]] tags will not be processed. This method should be used if a script indents to modify and save the page content. Version is an optional argument specifying the version number to return. If omitted, the current version is returned. |
| getAllPages() |
Array of Pages |
Returns an array of up to 250 Page objects with all data populated except for content. Use the offset version of this function to retrieve lists of more than 250 pages. |
| getAllPages (Number) | Array of Pages | Returns an array of up to 250 Page objects with all data populated except for content. The pages are offset by the Number argument. For example, if a site has 300 pages, getAllPages(0) will return the first 250 pages, and getAllPages(250) will return the last 50. |
| getRecentChanges(Date, Boolean) |
Array of Pages | Returns an array of pages containing recent changes. The content property of pages in the returned array is populated with the change description seen on the /_Recent report. The Date argument specifies how far back to search for changes. The Boolean argument specifies whether or not minor changes should be included in the results. |
| getUser(String) | User | Returns the user with the specified name, or null if the name is not found. |
| getUserChanges(String) |
Array of Pages |
Returns an array of page versions created by the named user. |
| newPage() | Page |
Creates and returns a blank page object. |
| newPolicy() | Policy | Creates and returns a blank policy object. |
| newUser() | User | Creates and returns a blank user object. |
| search (String) |
Array of Pages |
Performs the same search that is performed with EditMe's site search page. The 'content' property of each page object contains the snippet of relevant text that would normally be displayed in the search results. |
Example
<h1 editme="text site.title">site title goes here</h1>
Return to Java Script API