1
0
Fork
You've already forked brut
0

Pass collection context to mustache #34

Merged
robinmetral merged 9 commits from context into main 2024年08月11日 14:13:03 +02:00
robinmetral commented 2024年08月10日 08:13:49 +02:00 (Migrated from github.com)
Copy link

Closes #26

This is a pretty big change. Essentially, it:

  • introduces collections. Collections are defined in config and must match a directory name under the root pages directory
  • passes collection context to mustache. The context includes all posts (content and metadata) from these collections. It is passed to mustache as part of the view, which means it can be accessed in templates
  • lets users preprocess the context. This is useful because since mustache is logicless, the view needs to be build before passing it to the template

These should be enough to move a lot of logic out of custom build scripts, starting with the basic use case of iterating through a list of articles to render them on a page.

Closes #26 This is a pretty big change. Essentially, it: - **introduces collections**. Collections are defined in config and must match a directory name under the root pages directory - **passes collection context to mustache**. The context includes all posts (content and metadata) from these collections. It is passed to mustache as part of the view, which means it can be accessed in templates - **lets users preprocess the context**. This is useful because since mustache is logicless, the view needs to be build _before_ passing it to the template These should be enough to move a lot of logic out of custom build scripts, starting with the basic use case of iterating through a list of articles to render them on a page.
cloudflare-workers-and-pages[bot] commented 2024年08月10日 17:06:51 +02:00 (Migrated from github.com)
Copy link

Deploying brut with Cloudflare Pages Cloudflare Pages

Latest commit: de19b9a
Status: Deploy successful!
Branch Preview URL: https://context.brut.pages.dev

View logs

## Deploying brut with &nbsp;<a href="https://pages.dev"><img alt="Cloudflare Pages" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png" width="16"></a> &nbsp;Cloudflare Pages <table><tr><td><strong>Latest commit:</strong> </td><td> <code>de19b9a</code> </td></tr> <tr><td><strong>Status:</strong></td><td>&nbsp;✅&nbsp; Deploy successful!</td></tr> <tr><td><strong>Preview URL:</strong></td><td> <a href='https://32a28c27.brut.pages.dev'>https://32a28c27.brut.pages.dev</a> </td></tr> <tr><td><strong>Branch Preview URL:</strong></td><td> <a href='https://context.brut.pages.dev'>https://context.brut.pages.dev</a> </td></tr> </table> [View logs](https://dash.cloudflare.com/?to=/:account/pages/view/brut/32a28c27-83fd-40b2-9d0f-731304c48144)
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
robinmetral/brut!34
Reference in a new issue
robinmetral/brut
No description provided.
Delete branch "context"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?