Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 1.42 KB

File metadata and controls

59 lines (42 loc) · 1.42 KB
layout docs
order 1
tocHeading 2

Pages Data

To get started with, let's review the kind of content you can get as data.

Schema

Each page will return data in the following schema:

  • id - a unique kebabe-case transformation of the filename
  • title (customizable) - inferred title based on the filename
  • label (customizable) - inferred from the title if not configured
  • route - the filename converted into a path as per file based routing
  • data (customizable) - any custom frontmatter keys you've defined for your page

So for a page at src/pages/blog/first-post.md:

---
author: Project Evergreen
published: 2024-01-01
---

# First Post

This is my first post.

This is the data you would get back:

{
  "id": "blog-first-post",
  "title": "First Post",
  "label": "First Post",
  "route": "/blog/first-post/",
  "data": {
    "author": "Project Evergreen",
    "published": "2024-01-01"
  }
}

External Content

Using our Source plugin, just as you can get your content as data out of Greenwood, so can you provide your own sources of content (as data) to Greenwood. This is great for pulling content from a headless CMS, database, or anything else you can imagine!