analyze

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package analyze defines the analyzer pipeline: the Issue/Severity types, the Analyzer interface every check implements, and a Registry to hold them. Analyzers consume a crawler.Result and emit Issues; they never fetch the crawl themselves. This single seam is how new SEO/SEA checks are added without touching the engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	Name() string
	Description() string
	Analyze(ctx context.Context, result *crawler.Result) []Issue
}

Analyzer is a single check. Implementations must be safe for sequential reuse.

type Issue

type Issue struct {
	Analyzer string         `json:"analyzer"`
	URL      string         `json:"url"`
	Severity Severity       `json:"severity"`
	Code     string         `json:"code"`
	Message  string         `json:"message"`
	Data     map[string]any `json:"data,omitempty"`
}

Issue is a single finding emitted by an analyzer.

func EachPage

func EachPage(result *crawler.Result, fn func(p *crawler.Page) []Issue) []Issue

EachPage is a helper for per-page analyzers: it runs fn against every crawled page and concatenates the resulting issues.

func Run

func Run(ctx context.Context, analyzers []Analyzer, result *crawler.Result) []Issue

Run executes the given analyzers over result and concatenates their issues.

type Registry

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

Registry holds analyzers in registration order.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty Registry.

func (*Registry) All

func (r *Registry) All() []Analyzer

All returns every analyzer in registration order.

func (*Registry) Get

func (r *Registry) Get(name string) (Analyzer, bool)

Get returns the analyzer with the given name.

func (*Registry) Names

func (r *Registry) Names() []string

Names returns analyzer names in registration order.

func (*Registry) Register

func (r *Registry) Register(a Analyzer)

Register adds an analyzer. A later registration with the same name replaces the earlier.

func (*Registry) Select

func (r *Registry) Select(enabled, disabled []string) []Analyzer

Select returns the analyzers to run given enabled/disabled allow/deny lists. If enabled is non-empty, only those run (in registration order); otherwise all run except any in disabled. Unknown names in enabled are ignored.

type Severity

type Severity string

Severity classifies how important an Issue is.

const (
	Info    Severity = "info"
	Warning Severity = "warning"
	Error   Severity = "error"
)

Directories

Path Synopsis
Package aeo assesses Answer Engine Optimization: how well a page is structured to be surfaced as a direct answer in featured snippets, "People Also Ask", and voice results.
Package aeo assesses Answer Engine Optimization: how well a page is structured to be surfaced as a direct answer in featured snippets, "People Also Ask", and voice results.
Package amp implements AMP page detection, required-markup checks, and amphtml link validation against the crawled page set.
Package amp implements AMP page detection, required-markup checks, and amphtml link validation against the crawled page set.
Package content implements cross-page content analysis: thin content and pages whose word count falls well below the crawl-wide average.
Package content implements cross-page content analysis: thin content and pages whose word count falls well below the crawl-wide average.
Package datalayer audits Google Tag Manager / gtag wiring and the dataLayer event stream.
Package datalayer audits Google Tag Manager / gtag wiring and the dataLayer event stream.
Package duplicates implements cross-page duplicate detection: identical body content, titles, and meta descriptions across the crawl.
Package duplicates implements cross-page duplicate detection: identical body content, titles, and meta descriptions across the crawl.
Package geo assesses Generative Engine Optimization: whether AI answer engines (ChatGPT, Perplexity, Google AI Overviews, Gemini, Claude) can access the site and trust its content enough to cite it.
Package geo assesses Generative Engine Optimization: whether AI answer engines (ChatGPT, Perplexity, Google AI Overviews, Gemini, Claude) can access the site and trust its content enough to cite it.
Package hreflang implements hreflang annotation validity, self-reference, x-default, and return-link reciprocity checks across the crawled page set.
Package hreflang implements hreflang annotation validity, self-reference, x-default, and return-link reciprocity checks across the crawled page set.
Package httpx implements HTTP-level checks: status codes, redirect chains and loops, slow responses, and mixed content.
Package httpx implements HTTP-level checks: status codes, redirect chains and loops, slow responses, and mixed content.
Package images implements image checks: missing alt text and missing width/height dimension attributes.
Package images implements image checks: missing alt text and missing width/height dimension attributes.
Package landing assesses paid-campaign landing pages: how well the page's title and headings reflect the campaign keywords (utm_term / utm_campaign / utm_content), plus the quality-score signals ads care about (title, H1, meta description, indexability, HTTPS).
Package landing assesses paid-campaign landing pages: how well the page's title and headings reflect the campaign keywords (utm_term / utm_campaign / utm_content), plus the quality-score signals ads care about (title, H1, meta description, indexability, HTTPS).
Package links implements link analysis: broken internal links, links to redirects, nofollow and external link reporting, and empty anchor detection.
Package links implements link analysis: broken internal links, links to redirects, nofollow and external link reporting, and empty anchor detection.
Package pagination implements rel=next/prev pagination sequence detection and broken-target checks against the crawled page set.
Package pagination implements rel=next/prev pagination sequence detection and broken-target checks against the crawled page set.
Package perf reports Core Web Vitals from headless-rendered pages.
Package perf reports Core Web Vitals from headless-rendered pages.
Package robotscheck reports on robots.txt: presence, declared sitemaps, and crawled URLs that violate disallow rules.
Package robotscheck reports on robots.txt: presence, declared sitemaps, and crawled URLs that violate disallow rules.
Package seaurl parses UTM campaign parameters from URLs.
Package seaurl parses UTM campaign parameters from URLs.
Package security implements security checks: response headers (HSTS, CSP, X-Content-Type-Options) and insecure form actions.
Package security implements security checks: response headers (HSTS, CSP, X-Content-Type-Options) and insecure form actions.
Package seo implements technical on-page SEO checks (title, meta, canonical, headings, language, viewport, charset, social tags).
Package seo implements technical on-page SEO checks (title, meta, canonical, headings, language, viewport, charset, social tags).
Package sitemap discovers and parses sitemap.xml (including sitemap indexes) and cross-checks declared URLs against what was actually crawled.
Package sitemap discovers and parses sitemap.xml (including sitemap indexes) and cross-checks declared URLs against what was actually crawled.
Package structured extracts and reports on JSON-LD structured data (schema.org).
Package structured extracts and reports on JSON-LD structured data (schema.org).
Package tracking detects marketing and analytics tags on a page — Google Tag Manager, GA4, Universal Analytics, Google Ads, Meta (Facebook) Pixel, and a few others — and flags missing or duplicated installs.
Package tracking detects marketing and analytics tags on a page — Google Tag Manager, GA4, Universal Analytics, Google Ads, Meta (Facebook) Pixel, and a few others — and flags missing or duplicated installs.
Package urls implements URL hygiene checks: uppercase letters, underscores, non-ASCII characters, and excessive length.
Package urls implements URL hygiene checks: uppercase letters, underscores, non-ASCII characters, and excessive length.
Package utm audits UTM campaign tagging on a page's outbound links: partial tagging, empty or duplicated parameters, inconsistent key casing, and a per-page rollup.
Package utm audits UTM campaign tagging on a page's outbound links: partial tagging, empty or duplicated parameters, inconsistent key casing, and a per-page rollup.
Package wordpress fingerprints WordPress sites and runs WordPress-specific checks that the generic analyzers do not name.
Package wordpress fingerprints WordPress sites and runs WordPress-specific checks that the generic analyzers do not name.

Jump to

Keyboard shortcuts

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