Contents
installing nsm
nsm commands
content files
template files
displaying mathematics
displaying code blocks
hosting your site

Available Nift commands

Nift has a number of commands you can use that will help you manage and generate your websites. This page outlines how to list all the available commands and outlines what most of them do.

To use a command, enter nsm command parameter-1 ... parameter-n in to a terminal, command prompt or power shell window.

Listing available Nift commands

To list available Nift commands run nsm commands. The list will look similar to:

							+---------- available commands ----------------------------------------+
							| nsm commands       | lists all nsm commands                          |
							| nsm config         | lists config settings                           |
							| nsm clone          | input: repository-url                           |
							| nsm init           | initialise managing a site - input: (site-name) |
							| nsm status         | lists updated and problem pages                 |
							| nsm info           | input: page-name-1 .. page-name-k               |
							| nsm info-all       | lists tracked pages                             |
							| nsm info-names     | lists tracked page names                        |
							| nsm track          | input: page-name (page-title) (template-path)   |
							| nsm untrack        | input: page-name                                |
							| nsm rm or nsm del  | input: page-name                                |
							| nsm mv or nsm move | input: old-name new-name                        |
							| nsm cp or nsm copy | input: tracked-name new-name                    |
							| nsm build          | input: page-name-1 .. page-name-k               |
							| nsm build-updated  | builds updated pages                            |
							| nsm build-all      | builds all tracked pages                        |
							| nsm bcp            | input: commit-message                           |
							| nsm new-title      | input: page-name new-title                      |
							| nsm new-template   | input: page-name template-path                  |
							+----------------------------------------------------------------------+
						

Importing/Forking, renaming and cloning a site repository from BitBucket/GitHub/GitLab

You can import/fork and rename an existing site repository on BitBucket, GitHub or GitLab, then clone it using nsm clone repository-url. Note - You can rename a repository when importing it, rather than forking and renaming, plus on BitBucket and GitHub you cannot remove fork relationships. Also on GitHub you will need to go in to the site repository's settings, find the GitHub Pages section and set the source branch (typically master branch).

Initialise managing a site

To start managing a site: first change to the directory you would like to act as the site stage, that is the directory containing all site related files (content and template files inclusive); then run nsm init (site-name) where site-name is an optional parameter for the name of the site. A hidden directory .siteinfo will be created containing a pages.list file and config file nsm.config.

Note: once the stage directory for your site is set up, much the same as with git, Nift may be run from any directory within the stage directory (stage directory inclusive).

Listing updated pages

For information on pages that need building and why run nsm status.

Tracking new pages

To track a new page run nsm track page-name page-title template-path, where page-title and template-path are optional (default page-title is the specified page-name, and default template-path is template/page.template). Surround any titles and/or paths containg spaces with single or double quotes. If you want both spaces and single/double quotes in your title/path then surround it by double/single quotes.

The following should (hopefully) work as valid titles and paths (though if you are going to use spaces/quotes in titles/paths, test it thoroughly before depending on it working):

							home
							"home"
							"home page"
							"nick's page"
							'"quoted title"'
						
							content/index.content
							./content/index.content
							content/'index'.content
							"content/index.content"
							'content/index page.content'
						

Note: tabs and multiple spaces will currently be morphed into single spaces. If the available options for titles/paths are not flexible enough then ask and I can alter how titles/paths are read.

Listing tracked pages

To list information on all pages run nsm info-all, for just page names run nsm info-names, and for information on specific pages run nsm info page-name-1 .. page-name-k.

Untracking pages

To untrack a page run nsm untrack page-name. All information about the page is removed from .siteinfo/pages.list along with the page file and the page info file. It is up to you whether you want to manually remove any associated content and/or template files.

Moving pages

To move a page run nsm mv old-page-name new-page-name. All information about the old-page is removed from .siteinfo/pages.list along with the old page file and the old page info file, while information about the new page is added to .siteinfo/pages.list and the old content file is moved to the new content path.

Copying pages

To copy a page run nsm cp tracked-page-name new-page-name. Information about the new page is added to .siteinfo/pages.list and the old content file is copied to the new content path.

Removing pages

To remove a page run nsm rm page-name. The only difference to untrack is that the content file will also be removed from your system.

Building pages

To build updated pages run nsm build-updated, to build all pages run nsm build-all, and to build specific pages run nsm build page-name-1 .. page-name-k.

Building, committing and pushing changes to BitBucket/GitHub/GitLab

If your site is part of a repository for BitBucket, GitHub or GitLab you can have updated pages built along with the changes being committed and pushed using nsm bcp "commit message". Note you can still use nsm build-updated to check any changes locally (when changes can be viewed locally).

Changing a page title or template path

To set a new page title run nsm new-title page-name new-title and to set a new template path run nsm new-template new-template-path.

What information is tracked for a page?

While Nift is easiest to learn and understand by using, users may find it useful to remember that for each page Nift tracks a page name, page title and template path. In more detail, a list of pages is stored in the file .siteinfo/pages.list from where Nift is initialised. When building a page, say index, a page info file is created that stores information about page dependencies.

What is a page dependency?

Anything that when modified requires a page to be built, including:

Note: the modification/removal of a page file is intentionally not considered a page dependency. This is so that, should the user want to, pages may be moved (not just copied) outside the stage directory without Nift thinking the pages need to be built when in fact they do not.

How does Nift track modifications to page dependencies?

The information stored in a page information file represents the information from the last time the page was built. If the information file does not exist, as far as Nift is concerned the page has never been built. It will compare both: the page information from the info file against the information in .siteinfo/pages.list; and whether any of the content and/or template files have been modified since the page info file was modified, and hence since the page was last built.

While Nift will not pick up the existence of new content files that are merely added via other content files, in order for this to occur a content file which is already recorded as a page dependency must be modified. Consequently Nift will inform the user that any relevant pages require building, and upon the user building updated pages any new content files will also be recorded as page dependencies.