content/.smd.ziggy-schema

main
befree/content/.smd.ziggy-schema history · blame · raw

83 lines · 3439 bytes

 1$ = Page
 2
 3/// This is the schema of a SuperMD document frontmatter.
 4///
 5/// As a reminder, optionals ('?'), slices ('[]'), and dictionaries ('{:}')
 6/// can all be omitted, see https://ziggy-lang.io for more info.
 7///
 8/// Note that while some fields here are defined as optional,
 9/// in SuperHTML they will instead be non-optional with a default value.
10/// For example '?bytes' fields will default to an empty string, while
11/// slices and dictionaries will instead default to empty containers.
12///
13/// Make sure to read the SuperHTML reference to know how to properly
14/// access these fields (https://zine-ssg.io/docs/superhtml/scripty/).
15struct Page {
16    /// The title of this page.
17    title: ?bytes,
18    /// A short description of the page.
19    description: ?bytes,
20    /// The publishing date of this page.
21    date: Date,
22    /// The author(s) of this page.
23    authors: []bytes,
24    /// A list of tags for this page.
25    tags: []bytes,
26    /// Path to a layout file inside of the configured layouts directory.
27    layout: bytes,
28    /// Alternative paths where this content will also be made available.
29    ///
30    /// Note that the copies will be 100% identical to the main version,
31    /// if you need minor (or major) changes to other variants of this page,
32    /// you will want to use `alternatives`.
33    aliases: []bytes,
34    /// Alternative versions of this page, created by rendering the content
35    /// using a different layout and placed at a different URL.
36    ///
37    /// Useful for creating RSS feeds, for example.
38    alternatives: []Alternative,
39    /// In multilingual sites can be set to match corresponding pages that
40    /// don't have identical URLs. See 'i18n' docs for more info.
41    translation_key: ?bytes,
42    /// When set to true this file will be ignored when bulding the website,
43    /// unless the '--drafts' option has been passed to Zine.
44    draft: ?bool,
45    /// This property can only be set in the frontmatter of a section page
46    /// (i.e. a page named 'index.smd') to ensure that it will not contain
47    /// subsections.
48    ///
49    /// When set to true, any 'index.smd' subpage will trigger a build
50    /// error, requiring the user to reame the subpage to something else.
51    ///
52    /// As a reminder, `foo/bar/index.smd` and `foo/bar.smd` are equivalent
53    /// definitions with the only difference that the latter will not
54    /// define a new section.
55    ///
56    /// This property is useful for guaranteeing correct behavior from
57    /// `$page.leaves()` and other sectioning-related builtin functions.
58    forbid_subsections: ?bool,
59    /// User-defined properties that you can reference from SuperHTML via
60    /// '$page.custom'
61    custom: {:}any,
62
63    union Date {
64        /// A RFC3339 date string, e.g. "1990/01/01" or "1990/01/01T00:00:00".
65        date: bytes,
66        /// An epoch UNIX timestamp (seconds), e.g. 631148400.
67        unix: int,
68    }
69
70    struct Alternative {
71        /// A name that can be used to refer to this alternative version
72        /// of the page from SuperHTML.
73        name: bytes,
74        /// Path to a layout file inside of the configured layouts
75        /// directory.
76        layout: bytes,
77        /// Output path, relative to the current directory. Use an absolute
78        /// path to refer to the website's root directory.
79        output: bytes,
80        /// Useful when generating `<link rel="alternate">` elements.
81        type: ?bytes,
82    }
83}