Skip to content

Database format

The result of ortfo/db's build process is a database.json file. This file contains all of the projects that were processed.

Missing values

All fields described here are always present. If they are irrelevant or unknown, they are set to their zero value. Basically, numbers are 0, strings are "", arrays are [], and objects are {}.

WARNING

There's currently a bug where objects are null instead of {}. This will be fixed in a future release. This is because Go's zero value of maps is nil instead of an empty map.

Structure

The database is a JSON-encoded object that map works' IDs to objects containing the following fields:

ID
The ID of the work[1]. IDs of works are simply their folders' names, since those a guaranteed to be unique
buildAt
The date at which the work was last built. Useful for caching purposes
descriptionHash
A hash of the work's description file. Again, useful for caching purposes
metadata
See Metadata
content
An object that maps language codes (see Internationalization) to the work's content.
If you don't translate your descriptions to other languages, the single key in the object will be default.
Partial
true if the work was not fully built (e.g. if the build process was interrupted while processing that work), false otherwise

Metadata

Contains data about the work that is not part of the description itself, such as the date of creation, etc.

Most of these fields are set by the user in the description file's front-matter.

aliases

Array of strings that are other IDs that point to this work. Useful to express redirections. For example, if a work with ID ortfo has ["ortfodb", "ortfomk"] as the aliases field, then going to ortfodb's page should redirect to ortfo's page

finished

Date when the work was finished. Should be in the format YYYY-MM-DD

started

Date when the work was started. Should be in the format YYYY-MM-DD

tags

Array of strings that represent the tags of the work.

madeWith

(made with or using in the description file)

Array of strings that represent the technologies (in the very broad sense, this could be stuff like "oil paint" when the work is a painting, or "sveltekit" when it's a website) used to make the work.

thumbnail

Path, relative to the folder where the description.md file is, to the work's thumbnail. Useful to determine which media content block to use as the work's thumbnail

colors

Useful to express colors to use for that project. Might be filled automatically with Color extraction when not manually set by the user

pageBackground

(page background in the description file)

Path, relative to the folder where the description.md file is, to the work's background image. Useful to determine which media content block to use as the work pages's background image, for example

wip

Whether the project is considered a "Work in progress" or not

private

Whether the project is marked as private or not. Useful to hide works that are not ready to be shown yet, or to have "unlisted" works

additionalMetadata

Object that contains other metadata set by the user in the description file.

WARNING

There's currently a bug that makes madeWith's actual value appear here as made_with. This will be fixed in a future release.

Content

title

The works' title. This correspond's to the first-level header (# Like this) in the description file

footnotes

Maps footnote references to their definitions. See Footnotes

layout

A two-dimensional array that represents the layout of the work. Each element of the array is a string that represents a content block's ID.

See Layouts

blocks

Array of content blocks.

id
The ID of the block. IDs of blocks are generated by the compiler and are guaranteed to be unique per work
anchor
A human-readable unique identifier that can be used to create an anchor tag to that block. Might be empty
index
The position of that block in the description.md file. Starts at 0.
type
paragraph when the block is a Paragraph block
media when the block is a Media block
link when the block is a Link block
other fields depend on type
See just below
Paragraph blocks
content
The HTML content of that paragraph. See Markdown for more information about how the markdown syntax is processed, and what markdown features are handled by ortfo/db.
Media blocks

TODO. See the go documentation for Media in the meantime.

Here are the attributes:

go
Alt               string                        `json:"alt"`
Caption           string                        `json:"caption"`
RelativeSource    FilePathInsidePortfolioFolder `json:"relativeSource"`
DistSource        FilePathInsideMediaRoot       `json:"distSource"`
ContentType       string                        `json:"contentType"`
Size              int                           `json:"size"` // in bytes
Dimensions        ImageDimensions               `json:"dimensions"`
Online            bool                          `json:"online"`
Duration          float64                       `json:"duration"` // in seconds
HasSound          bool                          `json:"hasSound"`
Colors            ColorPalette                  `json:"colors"`
Thumbnails        ThumbnailsMap                 `json:"thumbnails"`
ThumbnailsBuiltAt string                        `json:"thumbnailsBuiltAt"`
Attributes        MediaAttributes               `json:"attributes"`
Analyzed          bool                          `json:"analyzed"` // whether the media has been analyzed
text
The text of the link. May contain HTML.
title
The link's title, to be used as the title attribute of the <a> tag
url
The URL the link points to

Schema & type definitions

JSON Schema
See JSON Schemas
Type definitions
For Go code, see the github.com/ortfo/db package
For other languages, see Client libraries

  1. This is technically redundant, but useful when you only have a single object and need to get the ID of the work ↩︎