Project internals
.nift/tracked.json.
tracked.json is the compact list of files/pages Nift is managing. Each tracked entry gives Nift a stable name, a title and a template; project-wide path rules come from config.json.
A small example
{
"tracked": [
{
"name": "/",
"title": "Home",
"template": "templates/template.html"
},
{
"name": "about",
"title": "About us",
"template": "templates/template.html"
},
{
"name": "docs/getting-started",
"title": "Getting started",
"template": "templates/docs.html"
}
]
}
Required fields
| Field | Meaning |
|---|---|
name | The tracked name used by Nift commands and @pathto. Nift derives content/output paths from this name plus the project config. |
title | The tracked item's title, exposed to templates as $[title]. |
template | The template file used to build that item. |
Optional per-item extensions
An entry can override the project's default content or output extension:
{
"name": "feed",
"title": "Feed",
"template": "templates/feed.xml",
"content-ext": ".xml",
"output-ext": ".xml"
}
The v4 reader recognises content-ext and output-ext on individual tracked entries. If they are absent, the defaults in .nift/config.json are used.
Names are the useful abstraction
Suppose your config uses content/, public/ and .html. This entry:
{
"name": "blog/hello-world",
"title": "Hello world",
"template": "templates/post.html"
}
corresponds to:
tracked name: blog/hello-world
content path: content/blog/hello-world.html
template path: templates/post.html
output path: public/blog/hello-world.html
Usually manage it through Nift
nift track about "About us" templates/template.html
nift mv about company
nift cp company team
nift untrack old-page
nift rm obsolete-page
Those commands update Nift's tracking information for you. Because the file is ordinary JSON, it is still easy to inspect, version-control and understand when debugging a project.
Validation Nift performs while loading
The current v4 reader requires a top-level tracked array, requires every item to have string name, title and template values, rejects duplicate tracked names, and rejects an item whose derived content path is the same as its template path.
config.json defines the global path/build rules; tracked.json lists the concrete outputs managed under those rules.