seo

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package seo derives deterministic page metadata, structured data, and site-level SEO artifacts such as sitemap.xml and robots.txt for rendered pages. Sitemap generation consumes page canonical URLs plus explicit page last-modified timestamps. Note-page Article JSON-LD falls back from frontmatter date to the note's normalized source timestamp before failing closed on any still-missing required schema fields, while valid BreadcrumbList JSON-LD remains emitted and site title provides the deterministic author fallback when an explicit site author is absent.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRSS

func BuildRSS(cfg model.SiteConfig, notes []model.NoteSummary) ([]byte, error)

BuildRSS renders a deterministic RSS 2.0 feed for published notes.

func BuildRobots

func BuildRobots(baseURL string) string

BuildRobots renders a permissive robots.txt with an absolute sitemap URL.

func BuildSitemap

func BuildSitemap(pages []model.PageData) ([]byte, error)

BuildSitemap renders deterministic sitemap.xml contents for the supplied public pages. Every emitted page must carry a canonical URL and explicit last-modified timestamp.

Types

type ArticleJSONLDError

type ArticleJSONLDError struct {
	MissingFields []string
}

ArticleJSONLDError reports which required Article JSON-LD fields are missing.

func (*ArticleJSONLDError) Error

func (e *ArticleJSONLDError) Error() string

type Metadata

type Metadata struct {
	Title       string
	Description string
	Canonical   string
	OG          model.OpenGraph
	TwitterCard string
}

Metadata contains the template-safe SEO fields derived for a single page.

func Apply

func Apply(page *model.PageData, note *model.Note) (Metadata, error)

Apply derives SEO metadata and copies the fields used by templates into PageData.

Page-level SEO metadata is always written into PageData. Note pages still return an error when their required Article JSON-LD fields are incomplete; any valid structured data that was serialized alongside that error remains in PageData.JSONLD and the rest of the metadata is still applied.

func Build

func Build(page model.PageData, note *model.Note) Metadata

Build derives SEO metadata for a rendered page.

Jump to

Keyboard shortcuts

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