48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package content
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// AuthorProfile is a simplified author representation for plugins.
|
|
type AuthorProfile struct {
|
|
ID uuid.UUID
|
|
Name string
|
|
Slug string
|
|
Bio string
|
|
AvatarURL string
|
|
Website string
|
|
SocialLinks map[string]string
|
|
}
|
|
|
|
// PageInfo is a simplified page representation for plugins.
|
|
type PageInfo struct {
|
|
ID uuid.UUID
|
|
Slug string
|
|
Title string
|
|
}
|
|
|
|
// PostInfo is a simplified post representation for plugins.
|
|
type PostInfo struct {
|
|
ID uuid.UUID
|
|
Slug string
|
|
Title string
|
|
Excerpt string
|
|
FeaturedImageURL string
|
|
AuthorID uuid.UUID
|
|
}
|
|
|
|
// Content provides content access for plugins.
|
|
// The CMS implements this interface and wires it into ServiceDeps.
|
|
type Content interface {
|
|
GetAuthorProfile(ctx context.Context, id uuid.UUID) (*AuthorProfile, error)
|
|
GetPage(ctx context.Context, slug string) (*PageInfo, error)
|
|
GetPost(ctx context.Context, slug string) (*PostInfo, error)
|
|
Slugify(text string) string
|
|
BlockNoteToHTML(ctx context.Context, doc map[string]any) string
|
|
GenerateExcerpt(html string, maxLen int) string
|
|
StripHTML(s string) string
|
|
}
|