Netlify Create provides multiple methods for viewing the structure of your site and the objects within it.
Navigation Properties
The following properties control navigation visibility and behavior.
siteMap
Explicitly sets the list of pages listed in the sitemap navigator.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
- Type definitions are being explored and may change.
- Notice the following about the highlighted code above:
pageModels
makes use ofmodelExtensions
by automatically retrieving a set of model names whentype
is set topage
.- Documents without a
slug
are ignored because aurlPath
cannot be determined. getLocalizedFieldForLocale
is a utility that introspects an object and returns the appropriate field object. Within that object, avalue
property contains the value for the field.
transformSitemap
Transform the sitemap to affect the visible pages in the sitemap navigator, based on the current user context.
1
2
3
4
5
6
7
8
9
10
11
- The function should return an array of
SiteMapEntry
objects. Entries not returned from this function will not be shown in the sitemap navigator. filterModel
andfilterDocument
are run beforetransformSitemap
. Filtered out documents will have already been removed from the sitemap.
transformTreeViews
Transforms the tree view to affect the documents and folders a user sees in the content editor tree view, based on the current user context.
1
2
3
4
5
6
7
8
9
10
11
- The function should return an array of
TreeViewNode
objects. Nodes not returned from this function will not be shown in the tree views. transformTreeViews
is called beforefilterModel
andfilterDocument
are run and may contain nodes connected to documents that are filtered out. These nodes get cleaned up afterfilterModel
andfilterDocument
have run and will be hidden appropriately.
treeViews
Controls the structure of the tree view in the content editor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
- The top-level
TreeViewNode
items must containchildren
or they will not be rendered in the tree.
Parameters
The function is passed a single options
object of type ConfigDelegate
, which contains the following properties:
getDefaultLocaleBySource
getDocumentById
getDocumentFieldForFieldPath
getDocuments
getLogger
getModelByName
getSchemas
These properties can be used to retrieve the models, documents, and field values necessary to build a tree with the site content.
Return Value
The return value should be an array of TreeViewNode
objects.
When the node in the tree represents a document, the shape of the object should be:
document
: ADocumentWithSource
object. If retrieving documents withoptions.getDocuments()
, supplying the individual documents here will suffice.label
(optional): Override the default label for the document, which is a title-like field.stableId
(optional): A unique ID for the document. This is unnecessary with typical usage.children
(optional): An array of nested tree view nodes.
When a node is a text-based grouping of other nodes, it supports the following properties:
label
: A string value, which will be the text shown on the screen.stableId
: A unique ID for the node.children
(optional): An array of nested tree view nodes.
The usage example above shows both of these node types.