seo

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package seo provides SEO meta tag and structured data management for ForgeUI.

The SEO plugin generates Open Graph, Twitter Card, and JSON-LD structured data to improve search engine visibility and social media sharing.

Basic Usage

registry := plugin.NewRegistry()
registry.Use(seo.New())

Features

  • Open Graph tags
  • Twitter Card tags
  • JSON-LD structured data
  • Canonical URL management
  • Robots meta tags

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlternateLink(lang, url string) g.Node

AlternateLink generates an alternate language link tag.

func DNSPrefetch

func DNSPrefetch(url string) g.Node

DNSPrefetch generates a DNS prefetch link tag.

func GenerateSitemap

func GenerateSitemap(urls []SitemapURL) string

GenerateSitemap generates a basic sitemap structure (not a full implementation).

func JSONLDNode

func JSONLDNode(data StructuredData) g.Node

JSONLDNode generates JSON-LD structured data node.

func MetaTagsNode

func MetaTagsNode(tags MetaTags) g.Node

MetaTagsNode generates meta tag nodes.

func Preconnect

func Preconnect(url string) g.Node

Preconnect generates a preconnect link tag for external domains.

func RSSLink(title, url string) g.Node

RSSLink generates an RSS feed link tag.

func SitemapLink(url string) g.Node

SitemapLink generates a sitemap link tag.

Types

type BreadcrumbItem struct {
	Name string
	URL  string
}

BreadcrumbItem represents a breadcrumb item.

type MetaTags

type MetaTags struct {
	// Basic meta tags
	Title       string
	Description string
	Keywords    []string
	Author      string
	Canonical   string

	// Open Graph
	OGTitle       string
	OGDescription string
	OGImage       string
	OGType        string
	OGURL         string
	OGSiteName    string

	// Twitter Card
	TwitterCard        string // summary, summary_large_image, app, player
	TwitterSite        string // @username
	TwitterCreator     string // @username
	TwitterTitle       string
	TwitterDescription string
	TwitterImage       string

	// Robots
	Robots    string // index,follow or noindex,nofollow
	GoogleBot string
	BingBot   string
}

MetaTags contains SEO meta tag configuration.

func DefaultMetaTags

func DefaultMetaTags() MetaTags

DefaultMetaTags returns default meta tags.

type SEO

type SEO struct {
	*plugin.PluginBase
}

SEO plugin.

func New

func New() *SEO

New creates a new SEO plugin.

func (*SEO) Init

func (s *SEO) Init(ctx context.Context, registry *plugin.Registry) error

Init initializes the SEO plugin.

func (*SEO) Shutdown

func (s *SEO) Shutdown(ctx context.Context) error

Shutdown cleanly shuts down the plugin.

type SitemapURL

type SitemapURL struct {
	Loc        string
	LastMod    string
	ChangeFreq string
	Priority   float64
}

SitemapURL represents a URL in a sitemap.

type StructuredData

type StructuredData struct {
	Type string         // Schema.org type (e.g., "Organization", "Article")
	Data map[string]any // Structured data fields
}

StructuredData contains JSON-LD structured data.

func ArticleSchema

func ArticleSchema(headline, description, image, datePublished, author string) StructuredData

ArticleSchema creates Article structured data.

func BreadcrumbSchema(items []BreadcrumbItem) StructuredData

BreadcrumbSchema creates BreadcrumbList structured data.

func OrganizationSchema

func OrganizationSchema(name, url, logo string) StructuredData

OrganizationSchema creates Organization structured data.

Jump to

Keyboard shortcuts

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