Bootstrapped during the 2026-06-06 BlockNinja consolidation. Was previously an unversioned directory inside ~/src/blockninja-themes/earthen. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
|
|
"git.dev.alexdunmow.com/block/core/blocks"
|
|
)
|
|
|
|
// FieldNoteBlockMeta defines metadata for the field note block.
|
|
var FieldNoteBlockMeta = blocks.BlockMeta{
|
|
Key: "field_note",
|
|
Title: "Field Note",
|
|
Description: "Article-style dispatch from the field with byline and location",
|
|
Source: "earthen",
|
|
Category: blocks.CategoryContent,
|
|
}
|
|
|
|
// FieldNoteBlock renders the field note block.
|
|
// Content shape: {author, location, dateline, body, image}
|
|
func FieldNoteBlock(ctx context.Context, content map[string]any) string {
|
|
data := FieldNoteData{
|
|
Author: getString(content, "author"),
|
|
Location: getString(content, "location"),
|
|
Dateline: getString(content, "dateline"),
|
|
Body: getString(content, "body"),
|
|
Image: getString(content, "image"),
|
|
Empty: len(content) == 0,
|
|
}
|
|
|
|
var buf bytes.Buffer
|
|
_ = fieldNoteComponent(data).Render(ctx, &buf)
|
|
return buf.String()
|
|
}
|
|
|
|
// FieldNoteData contains data for the field note component.
|
|
type FieldNoteData struct {
|
|
Author string
|
|
Location string
|
|
Dateline string
|
|
Body string
|
|
Image string
|
|
Empty bool
|
|
}
|