seo

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidMetaDescription is returned when meta description validation fails
	ErrInvalidMetaDescription = errors.New("meta description must be between 1 and 160 characters")
	// ErrInvalidOGTitle is returned when OG title validation fails
	ErrInvalidOGTitle = errors.New("og title must be between 1 and 60 characters")
	// ErrInvalidOGDescription is returned when OG description validation fails
	ErrInvalidOGDescription = errors.New("og description must be between 1 and 160 characters")
)

Functions

func ValidateMetaDescription

func ValidateMetaDescription(metaDescription string) error

ValidateMetaDescription validates the meta description field

func ValidateOGDescription

func ValidateOGDescription(ogDescription string) error

ValidateOGDescription validates the OG description field

func ValidateOGTitle

func ValidateOGTitle(ogTitle string) error

ValidateOGTitle validates the OG title field

Types

type GenerateInput

type GenerateInput struct {
	Title           string
	Content         string // TipTap JSON or HTML (see Format)
	Format          string // "html" → HTML extraction; anything else (including "") → TipTap extraction
	FeaturedImage   string
	URL             string
	DatePublished   string
	DateModified    string
	AuthorName      string
	Tags            []string
	MetaDescription string // Optional override
	OGTitle         string // Optional override
	OGDescription   string // Optional override
}

GenerateInput contains input data for SEO metadata generation

type GeneratedMetadata

type GeneratedMetadata struct {
	MetaDescription    string
	OGTitle            string
	OGDescription      string
	OGImage            string
	OGURL              string
	OGType             string
	OGSiteName         string
	TwitterCard        string
	TwitterTitle       string
	TwitterDescription string
	TwitterImage       string
	JSONLD             map[string]any
}

GeneratedMetadata contains all generated SEO metadata

type SEOMetadata

type SEOMetadata struct {
	MetaDescription string `json:"metaDescription"`
	OGTitle         string `json:"ogTitle"`
	OGDescription   string `json:"ogDescription"`
}

SEOMetadata represents SEO metadata for content

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles SEO metadata generation

func NewService

func NewService(baseURL, siteName string) *Service

NewService creates a new SEO service

func (*Service) Generate

func (s *Service) Generate(input GenerateInput) (*GeneratedMetadata, error)

Generate generates SEO metadata from the input data

Jump to

Keyboard shortcuts

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