seo

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package seo provides SEO optimization for GoSPA projects. Includes meta tags, sitemap generation, structured data (JSON-LD), and Open Graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// SiteURL is the base URL of the website.
	SiteURL string `yaml:"site_url" json:"siteUrl"`

	// SiteName is the name of the website.
	SiteName string `yaml:"site_name" json:"siteName"`

	// DefaultTitle is the default page title.
	DefaultTitle string `yaml:"default_title" json:"defaultTitle"`

	// DefaultDescription is the default meta description.
	DefaultDescription string `yaml:"default_description" json:"defaultDescription"`

	// DefaultImage is the default Open Graph image.
	DefaultImage string `yaml:"default_image" json:"defaultImage"`

	// TwitterHandle is the Twitter/X handle (@username).
	TwitterHandle string `yaml:"twitter_handle" json:"twitterHandle"`

	// Language is the default language code.
	Language string `yaml:"language" json:"language"`

	// OutputDir is where generated SEO files are written.
	OutputDir string `yaml:"output_dir" json:"outputDir"`

	// GenerateSitemap enables sitemap.xml generation.
	GenerateSitemap bool `yaml:"generate_sitemap" json:"generateSitemap"`

	// GenerateRobots enables robots.txt generation.
	GenerateRobots bool `yaml:"generate_robots" json:"generateRobots"`

	// RoutesDir is where route files are located.
	RoutesDir string `yaml:"routes_dir" json:"routesDir"`
}

Config holds SEO plugin configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default SEO configuration.

type PageSEO

type PageSEO struct {
	Path        string   `json:"path"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Image       string   `json:"image"`
	Keywords    []string `json:"keywords"`
	NoIndex     bool     `json:"noIndex"`
	NoFollow    bool     `json:"noFollow"`
	Canonical   string   `json:"canonical"`
	Modified    string   `json:"modified"`
	ChangeFreq  string   `json:"changeFreq"`
	Priority    float64  `json:"priority"`
}

PageSEO represents SEO metadata for a page.

type SEOPlugin

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

SEOPlugin provides SEO optimization capabilities.

func New

func New(cfg *Config) *SEOPlugin

New creates a new SEO plugin.

func (*SEOPlugin) Commands

func (p *SEOPlugin) Commands() []plugin.Command

Commands returns custom CLI commands.

func (*SEOPlugin) Dependencies

func (p *SEOPlugin) Dependencies() []plugin.Dependency

Dependencies returns required dependencies.

func (*SEOPlugin) GeneratePageMeta

func (p *SEOPlugin) GeneratePageMeta(page PageSEO) string

GeneratePageMeta generates meta tags for a specific page.

func (*SEOPlugin) GetConfig

func (p *SEOPlugin) GetConfig() *Config

GetConfig returns the current configuration.

func (*SEOPlugin) Init

func (p *SEOPlugin) Init() error

Init initializes the SEO plugin.

func (*SEOPlugin) Name

func (p *SEOPlugin) Name() string

Name returns the plugin name.

func (*SEOPlugin) OnHook

func (p *SEOPlugin) OnHook(hook plugin.Hook, ctx map[string]interface{}) error

OnHook handles lifecycle hooks.

type StructuredData

type StructuredData struct {
	Type       string                 `json:"@type"`
	Context    string                 `json:"@context"`
	Properties map[string]interface{} `json:"-"`
}

StructuredData represents JSON-LD structured data.

Jump to

Keyboard shortcuts

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