Building Sites from the Console
When the Yurt CMS is installed, a commandline application is also installed, called yurt. This application is designed to facilitate much of the site management that needs to be done.
Creating a New Site
$ yurt newsite foldername [port]
This command is used to create a new directory structure, and set up an apache config file. Replace foldername with the name of the top-level directory you wish to create. An optional port may be specified. This value, which defaults to 9878, is the port # that the Apache web server will listen to for this site. Consult the "Web Server Configuration" section in Download and Installation for more directions on how to set up the site with the web server.
Adding Content to the Site
$ yurt newfile path/to/file
$ yurt newpartial path/to/file
When you're ready to start adding content, run one of these commands in your terminal. The path/to/file must be in your foldername/content/ directory. This command will create a file template for you to edit. The file template will look something like this (for a newfile:
---
template: template.html
title: enter page title
description: enter page meta description content
keywords: enter keywords here
content: |-
Enter your content here. Please ensure that you begin
each new line with two spaces while in this area.
and like this for a newpartial:
---
partial: yes
content: |-
Enter your content here. Please ensure that you begin
each new line with two spaces while in this area.
These are a valid YAML files that you can edit with your favorite text editor. When editing these files, make sure you should only change the values after the colon character.
The content field is a bit trickier to edit, but not by much. Add your content below the content: |- line, making sure that each new line you start begins with two spaces. Most text editors can be configured to preserve the indentation for each line you start. Make sure though that new lines begin with 2 spaces, not a 2-space tab. When adding content in this area, you can add either raw HTML or Markdown formatted content.
When to Create a New File or a Partial
Two file-creation commands are created to account for the two types of content you need to add to the site. Running yurt newfile will add a new web page, and supply you with the required metadata that needs to be added. Running yurt partial will create a special type of file where the contents are expected to be included in one or more files. Examples of commonly-required partials include the menu and the copyright notice.
Creating a New Folder
$ yurt mkdir path/to/foldername
This command is needed to create new folders. The supplied folder name is created in 3 places, so it's important to not use the terminal's mkdir command. As with yurt newfile and yurt newpartial, yurt mkkdir must be supplied with a path that's within the content/ directory.
Deleting Files/Folders
$ yurt delete /path/to/resource
This command will delete either files or folders in the content/ and the htdocs/ directories. Keep in mind that folders must be empty of files before they can be deleted.
Generating HTML From the Soure Files
$ yurt generate /path/to/file
To generate HTML versions of a content file, run the yurt generate command, supplying a path that resolves to a file within the content/ directory.