package page

import "golang.org/x/pkgsite/internal/frontend/page"

Package page defines common fields shared by pages when rendering templages.

Index

Types

type BasePage

type BasePage struct {
	// HTMLTitle is the value to use in the page’s <title> tag.
	HTMLTitle string

	// MetaDescription is the html used for rendering the <meta name="Description"> tag.
	MetaDescription safehtml.HTML

	// Query is the current search query (if applicable).
	Query string

	// Experiments contains the experiments currently active.
	Experiments *experiment.Set

	// DevMode indicates whether the server is running in development mode.
	DevMode bool

	// LocalMode indicates whether the server is running in local mode (i.e. ./cmd/pkgsite).
	LocalMode bool

	// AppVersionLabel contains the current version of the app.
	AppVersionLabel string

	// GoogleTagManagerID is the ID used to load Google Tag Manager.
	GoogleTagManagerID string

	// AllowWideContent indicates whether the content should be displayed in a
	// way that’s amenable to wider viewports.
	AllowWideContent bool

	// Enables the two and three column layouts on the unit page.
	UseResponsiveLayout bool

	// SearchPrompt is the prompt/placeholder for search input.
	SearchPrompt string

	// SearchMode is the search mode for the current search request.
	SearchMode string

	// SearchModePackage is the value of const searchModePackage. It is used in
	// the search bar dropdown.
	SearchModePackage string

	// SearchModeSymbol is the value of const searchModeSymbol. It is used in
	// the search bar dropdown.
	SearchModeSymbol string
}

BasePage contains fields shared by all pages when rendering templates.

func (*BasePage) SetBasePage

func (p *BasePage) SetBasePage(bp BasePage)

type ErrorPage

type ErrorPage struct {
	BasePage
	TemplateName    string
	MessageTemplate template.TrustedTemplate
	MessageData     any
}

ErrorPage contains fields for rendering a HTTP error page.

Source Files

page.go

Version
v0.0.0-20250218150137-224a1368cf02 (latest)
Published
Feb 18, 2025
Platform
linux/amd64
Imports
3 packages
Last checked
2 months ago

Tools for package owners.