cmsblocks

module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0

README

cmsblocks

Tests Status Go Report Card PkgGoDev

Reusable dracory/cmsstore custom block types for Blueprint-style projects.

Block types

Package Type key Renders
blogpost blog_post A single blog post (auto-detected from URL or fixed post_id), with tags, share links, prev/next navigation
blogpostlist blog_post_list Paginated blog post cards, column layout, excerpts
search search Search box + paginated results across CMS pages and blog posts

Installation

go get github.com/dracory/cmsblocks

Usage

postURL := func(postID, postSlug string) string {
    return links.Website().BlogPost(postID, postSlug) // or any project URL builder
}

// Single blog post
post := blogpost.NewBlogPostBlockType(blogStore)
post.SetPostURLFunc(postURL) // optional — defaults to /blog/post/{id}/{slug}
cmsstore.RegisterCustomBlockType(post)

// Paginated blog post list
list := blogpostlist.NewBlogPostListBlockType(blogStore)
list.SetPostURLFunc(postURL)
cmsstore.RegisterCustomBlockType(list)

// Search across CMS pages and blog posts
search := search.NewSearchBlockType(cmsStore, blogStore)
search.SetPostURLFunc(postURL)
cmsstore.RegisterCustomBlockType(search)

Each block type accepts an optional SetPostURLFunc so the project controls the public post URL format; without it, links default to /blog/post/{id}/{slug}.

Dependencies

dracory/blogstore, dracory/bs, dracory/cdn, dracory/cmsstore, dracory/form, dracory/hb, dracory/social, dracory/test, samber/lo, spf13/cast, modernc.org/sqlite.

Directories

Path Synopsis
internal
teststore
Package teststore builds real in-memory SQLite-backed stores for tests.
Package teststore builds real in-memory SQLite-backed stores for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL