opengraph

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	Title       Property `validate:"required"`
	ObjectType  Property `validate:"required"`
	URL         Property `validate:"required"`
	Image       Property `validate:"required"`
	Description Property
}

Metadata represents the default opengraph metadata properties used by the app on pages.

func NewMetadata

func NewMetadata(options ...Option) *Metadata

NewMetadata creates a new opengraph Metadata object with properties set to values given by the options. Where a property is not set by an option, a default value will be used.

func (*Metadata) Render

func (m *Metadata) Render() templ.Component

type Option

type Option func(*Metadata)

func WithDescription

func WithDescription(desc string, attrs templ.Attributes) Option

WithDescription option sets a custom og:desc property with optional element attributes. If this option is not used a default description will be set.

func WithImage

func WithImage(image string, attrs templ.Attributes) Option

WithImage option sets a custom og:image property with optional element attributes. If this option is not used a default image will be set.

func WithTitle

func WithTitle(title string, attrs templ.Attributes) Option

WithTitle option sets a custom og:title property with optional element attributes. If this option is not used a default title will be set.

func WithType

func WithType(objectType string, attrs templ.Attributes) Option

WithType option sets a custom og:type property with optional element attributes. If this option is not used a default type will be set.

func WithURL

func WithURL(url string, attrs templ.Attributes) Option

WithURL option sets a custom og:url property with optional element attributes. If this option is not used a default url will be set.

type Property

type Property struct {
	Value      string
	Attributes templ.Attributes
}

Jump to

Keyboard shortcuts

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