Page attributes

This topic describes how each page attribute works. If you have questions about a page attribute, please respond here. If you think there’s a bug with a page attribute please submit a bug report by clicking on the “Bug Report” link in the header.

To see a real example for each of these attributes, see the page.json files in Pavilion’s Landing Pages (the pages used on this site), such as Welcome page.json.

Name

The page name is determines how the page will be labeled in the pages admin interface and will also be used in the page document title (the text that appears in the browser tab). The full document title is

SiteSetting.title + " | #{@page.name}"

i.e. the discourse site setting title followed by a | then your page name.

Path

The page path is the path in the URL where your page will appear. The path is added to your base discourse url to form the full page URL. If your forum is forum.website.com and you set your page path to “welcome”, the full page URL will be forum.website.com/welcome.

You can’t use a path that already exists in Discourse such as about or faq. You also can’t use a path you’ve used for another page. If you try to enter either, you’ll get a “path already exists” error.

Menu

The menu attribute determines which menu a page will use in the page header. Currently the only way to add menus is in a global pages.json file, and the only place the menu can be used is in the header. Additional ways of adding menus and of using them in pages are welcome as suggestions (post below), or as feature requests.

Theme

The theme attribute determines which discourse theme to use with the page a theme can be used to include CSS, JS, image and other asset files in a page. Any theme that is installed on your Discourse instance can be used here, either by selection in the pages admin interface or by using the theme’s name or id in a theme field in the page.json file for a page.

Groups

The groups attribute determines which user groups can see the page. If this attribute is blank, all users (and guests) can see the page. Multiple user groups can be used here. This attribute can be set in the pages admin interface, or by using the group id or name in a groups field in the page.json file for a page.

Body

The body is the page’s body html, in the form of Embedded Ruby HTML. You can use any markup you can normally use in any .html.erb file, in addition to the supported Partials and Helpers. This attribute can be set via the admin interface or by adding a body.html.erb file in the same path as a page.json file in a pages repository.

Assets

Assets are the landing page assets that will be made available for use and display in the body.html.erb when a page is loaded. Currently assets can only be added to your discourse using an assets registry in a pages repository, and can only be made available for a page by including an assets field in a page.json file for a page.