Edit content in an Astro, Eleventy or Vite project
An author can edit page fields from Start and manage collection entries from Pro in the site’s Content tab. A developer declares which files the project reads. Tuqo writes the content to these files before running the build command.
A heading in Astro
Place tuqo.content.json next to package.json in the build root. For a Git monorepo, use the root directory configured for the site.
{
"output": "files",
"groups": {
"hero": {
"fields": {
"title": {
"type": "string",
"label": "Heading"
}
}
}
},
"files": [
{
"group": "hero",
"path": "src/data/hero.json"
}
],
"seed": {
"fields": {
"hero.title": "Opening on Saturday"
}
}
}
Read the generated JSON in src/pages/index.astro:
---
import hero from '../data/hero.json';
---
<h1>{hero.title}</h1>
Deploy the source archive or connect the repository with Git. The first build creates src/data/hero.json with the seed value. Open Content, change the heading and save the draft. Select Build preview. When it is ready, enable Preview link and select Open preview to see the change. Publish to update the public site once the build succeeds. Both operations consume build minutes. If the build fails, the live version stays available and the draft keeps the edit.
When connecting a project for the first time without seed, Tuqo reads the initial values from existing files at the declared paths. Missing files use field defaults and empty collections. An incompatible format stops the build before files are replaced. An explicit seed, as in the example above, supplies the initial values for the first connection. Subsequent builds use the editor content.
JSON for a catalogue, Markdown for news
Here is a separate tuqo.content.json for two collections. The build reads the products as a JSON array and each news item from a Markdown file.
{
"output": "files",
"collections": {
"products": { "fields": { "name": { "type": "string" }, "price": { "type": "price" } } },
"news": { "fields": { "title": { "type": "string" }, "body": { "type": "richtext" } } }
},
"files": [
{ "collection": "products", "path": "data/products.json" },
{ "collection": "news", "path": "content/news/*.md", "body": "body" }
]
}
Put the initial records in data/products.json.
[{ "id": "tea", "name": "Tea", "price": 350 }]
Save the first article as content/news/opening.md. The frontmatter between the --- delimiters must be a JSON object with id and fields. The filename must match the ID. You can write ordinary Markdown in the body. When generating the Markdown body, Tuqo escapes user-supplied HTML and template expressions.
---
{"id":"opening","fields":{"title":"Opening"}}
---
Join us **on Saturday**.
Declare paths relative to the build root under data/, _data/, content/ or their equivalents under src/. Dedicate a directory to a Markdown collection. The editor manages the *.md files immediately inside it. Use a string, text or richtext field for its body. Records marked as drafts remain in the editor and are omitted from the exported files.
Local preview and saving edits
Set TUQO_API_KEY in your environment. The key needs content view permission on the site to pull files and content edit permission to push them. From the project directory, run npx @tuqo/cli content pull . --site <site_id>, then start your local dev server. The CLI downloads editor images to public/_content/ by default. If your build serves static files from static/, pass --public-dir static when pulling.
Save your changes to the draft with npx @tuqo/cli content push . --site <site_id>. To add a Markdown record, create a file with a unique ID. Deleting the file of a visible record removes that record from the draft on push. If versions conflict, back up your edits, pull the latest files and merge your changes. Publish the result from the Content tab.
Limits and source snapshots
The schema file can be up to 64 KiB, the draft up to 5 MiB, and a collection up to 1,000 records including hidden ones. A build or sync can generate up to 2,000 JSON and Markdown files with a combined size of up to 16 MiB.
The compressed source snapshot can be up to 50 MiB, including for Git builds. It stays with the deploy and counts toward storage usage. Content publication rebuilds the saved source for the selected version. Changes to code in Git reach the site through a normal Git deploy. For a Git-connected site, the Node command runs without the .git directory on both the initial build in file mode and later rebuilds. If the site needs a version identifier, include it in the source files.