Documentation
¶
Overview ¶
Package seo provides SEO optimization for GoSPA projects. Includes meta tags, sitemap generation, structured data (JSON-LD), and Open Graph.
Index ¶
- type Config
- type PageSEO
- type SEOPlugin
- func (p *SEOPlugin) Commands() []plugin.Command
- func (p *SEOPlugin) Dependencies() []plugin.Dependency
- func (p *SEOPlugin) GeneratePageMeta(page PageSEO) string
- func (p *SEOPlugin) GetConfig() *Config
- func (p *SEOPlugin) Init() error
- func (p *SEOPlugin) Name() string
- func (p *SEOPlugin) OnHook(hook plugin.Hook, ctx map[string]interface{}) error
- type StructuredData
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 (*SEOPlugin) Dependencies ¶
func (p *SEOPlugin) Dependencies() []plugin.Dependency
Dependencies returns required dependencies.
func (*SEOPlugin) GeneratePageMeta ¶
GeneratePageMeta generates meta tags for a specific page.
type StructuredData ¶
type StructuredData struct {
Type string `json:"@type"`
Context string `json:"@context"`
Properties map[string]interface{} `json:"-"`
}
StructuredData represents JSON-LD structured data.
Click to show internal directories.
Click to hide internal directories.