Adding Pages
Pages are Markdown documents that use a template engine for rendering; to add a new page to your website create a file with a .md
extension in the site
folder.
For brevity this documentation will omit the site
prefix when specifying source file paths; unless otherwise specified you should assume file paths refer to documents in the site
directory.
File names correspond to the links for your pages so you should follow some simple conventions when naming files:
- Use lowercase characters
- Use hyphens to delimit words (avoid spaces and underscores)
This will make your website links easy to understand and is considered best practices for Search Engine Optimization (SEO).
To create a new page add a Markdown file with a .md
extension to the project site
directory, let's call it contact.md
.
Now run the live reload server uwe dev
and navigate to the /contact/
URL; when you save changes to the page the browser tab will reload.
Defining Page Data
Page data is defined as TOML; it is loaded first from the global page data in the settings then from a [pages]
table if it exists and finally from the file front matter which takes precedence.
Global Data
Define global variables to be made available to all page templates in the [page]
section of the settings:
[]
= "Description of the project"
= "Vanilla, Static, Website"
Pages Table
You can assign data to specific pages by source path using the [pages]
table if necessary. This example shows how to avoid embedding front matter in a file yet still apply page data:
[]
= true
= false
= false
We think front matter makes the project easier to understand so we recommend using it wherever possible.
Be sure to quote the path to prevent a TOML error; paths are resolved relative to the site
directory and it is an error if the file does not exist. So that paths are platform independent you should always use a forward slash.
Using HTML
If you want to also use plain HTML files with the .html
extension then you can add this to your site settings:
[]
= ["html"]
HTML files are not parsed as Markdown but you can use the markdown helper if you need it.
Mixing HTML with Markdown makes naming collisions more likely, see clean URLs for more information.
The next section looks at defining data for individual pages using front matter and the meta data typically assigned to pages.