package main import ( "bytes" "context" "git.dev.alexdunmow.com/block/core/blocks" ) // MetaStripBlockMeta defines the Metadata Strip block. var MetaStripBlockMeta = blocks.BlockMeta{ Key: "meta_strip", Title: "Metadata Strip", Description: "Mono uppercase strip: CLIENT / YEAR / DISCIPLINE / LOCATION", Category: blocks.CategoryContent, Source: "brutalist", } // MetaStripItem is one label/value pair in the metadata strip. type MetaStripItem struct { Label string Value string } // MetaStripData carries data for the metadata strip component. type MetaStripData struct { Items []MetaStripItem } // MetaStripBlock renders the metadata strip. // Content: {"items": [{"label":"CLIENT","value":"..."}, ...]} func MetaStripBlock(ctx context.Context, content map[string]any) string { raw := getSlice(content, "items") items := make([]MetaStripItem, 0, len(raw)) for _, item := range raw { items = append(items, MetaStripItem{ Label: getString(item, "label"), Value: getString(item, "value"), }) } var buf bytes.Buffer _ = metaStripComponent(MetaStripData{Items: items}).Render(ctx, &buf) return buf.String() }