Tina Docs
Introduction
Core Concepts
Querying Content
Editing
Customizing Tina
Going To Production
Drafts
Guides
Further Reference

Single Document Collections

Table of Contents

Overview

In Tina, single-document collections refer to collections that can only accommodate a solitary document. In the UI, achieving this can be accomplished by disabling the creation and deletion buttons through setting ui.allowedActions.create and ui.allowedActions.delete to false. For more information, please refer to the Collection Reference.

export default defineConfig({
collections: [
{
label: 'Site Settings',
name: 'siteSettings',
path: 'content/settings',
format: 'json',
fields: [
{
type: 'string',
label: 'Site Title',
name: 'title',
},
],
ui: {
allowedActions: {
create: false,
delete: false,
},
},
},
],
});

Once both settings have been applied, and the document contains a single file, the UI will forego the list page and direct the user straight to the document.

Caveats

At present, query generation isn't available, meaning you'll need to craft your custom query.

It's worth noting that setting ui.allowedActions merely modifies the user interface. If you'd like to prevent the API from adding more files to the collection, you can do so by utilizing the match property, as detailed in the Collection Docs.

match: {
include: 'documentName'
}

By implementing this, new documents will be prevented from being created.

Last Edited: March 28, 2023