Adding Web Pages

Many organizations want a landing page to promote courses or events. They may also want a separate web page for the purpose of communicating information, such as an FAQ or Contact Us page.

The Expanded Content Management feature, which is similar to a those provided by a content management system (CMS) provides the ability to create HTML content pages that are accessible to new visitors to the site as well as registered students and staff. These pages can be accessible to all visitors, registered users only, or to selected groups of users within the registered users giving you the flexibility to deliver targeted information.

Once implemented, the page can be made available via a user-friendly URL such as https://yoururl.com/yourpage.

Step-by-step Guide

To create a new web page

  1. Go to Site Administration > Pages > Add/edit Pages.

  2. Type a name for the page. This is the name that can appear at the top of the page. 

  3. Type a short name for the page. This is used by the LMS to refer to the page wherever space is limited, like in the breadcrumb for example. 

  4. In the "slug" field, enter the short word where users can access the web page. Using the example above (e.g. https://yoururl.com/myfamouscourse), you would enter "myfamouscourse" in the "slug" field.

  5. In the Page content field, compose and format your content using the HTML editor.

  6. Click Save changes . 

Optional Fields

Custom CSS. If you require custom formatting, you can include custom css entries in the CSS field.

Custom Javascript. If you require custom functionality, can include javascript in the javascript field.

Using JavaScript to Redirect Users

Some organizations want to put a "slug" on pages that pre-exist in the system. For example, they might want a user-friendly URL such as https:://mysite.dualcode.com/covid to redirect all users to the COVID-19 course, which is normally found at https://mysite.dualcode.com/course/view.php?id=432

A solution is to put a snippet of code in the JavaScript field as per the following:

window.location.replace('/course/view.php?id=432');

Note that in the example above, the string inside the parentheses would be the actual URL of the page you want users to be redirected to (in our case, the URL of the COVID course).

Appearance Fields

Hidden. Enabling the Hidden field hides the page from anyone other than people who have permission to edit pages.

Display page name. If you want the page name to appear at the top of the page when visitors view the page, enable this checkbox.

Require login. If you want this page to only be accessible to visitors that have logged into the site, enable this checkbox.

Require capabilities. Require capabilities allows you to very specific in identifying who can access this page. For example, if you want to create a page that is only accessible by users who are teachers, you can limit access using this field.

Examples

Example 1. To restrict a page to System Administrator, use a permission that only they have, such as local/serverhealth:view.

Example 2. To limit access to a page to users that have the ability to create programs (e.g. System Administrators and Course Creators), type local/program:add.

Example 3. You can combine multiple capabilities together by separating them with commas. For example: local/serverhealth:view,local/program:add.

Please note that when combining capabilities, the entries are evaluated so that if the user possesses ANY of the capabilities, they will be able to access the page. They are evaluated as a logical OR.

For an exhaustive list of capabilities, please refer to https://docs.moodle.org/39/en/Category:Capabilities.

Related Articles