Create a custom page
For all three types of Custom HTML Pages you need to follow the same syntax in your HTML. See Custom pages overview. CONTENTdm custom pages rely on finding basic configurations at the top of the HTML file using YAML syntax. These YAML configurations allow you to include or hide the built-in CONTENTdm header or footer and to provide a page title (the contents of the
<title> element in the page’s
<head> section). These YAML settings look like this:
--- header: true footer: true title: The simplest custom HTML page ---
In the above example, the built-in CONTENTdm header and footer have both been enabled and the page title has been defined. Immediately following the 5 lines of YAML text comes the HTML that renders the page content for your custom page. This should be standard HTML, for example:
<div> <h2>Hello, World!</h2> </div>
If you combine the example YAML section above with this example div, you will get a custom page that renders like this:
The HTML file that was uploaded in the Website Configuration Tool looks like this:
- View the page source to see the syntax.
If you prefer that your custom page has a completely clean slate and displays none of the built-in CONTENTdm UI, you can set header and footer to false, e.g.:
Which is the result of uploading this HTML file:
- View page source to see the syntax.
These examples are all using the Custom > Custom Pages feature in the Website Configuration Tool, but the principles are the same if you are uploading custom HTML for your home page or custom HTML collection landing pages. In all cases, the file that you upload in the Website Configuration Tool must include the YAML-syntax header at the top of the file and must be named with the “.html” file extension. For standalone custom HTML pages, the CONTENTdm website will automatically remove the “.html” from the URL that renders the custom page. For a custom HTML home page and for custom HTML collection landing pages, the file name is not used in the URL since those HTML pages are replacing built-in CONTENTdm pages that already have a URL.