settings

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package settings gives typed access to the site settings (a singleton content type registered by fields.Core). Templates see the same values as .Site.<field>.

Index

Constants

View Source
const (
	SiteName       = "siteName"
	BaseURL        = "baseURL"
	Language       = "language"
	ServerURL      = "serverURL"
	DefaultOGImage = "defaultOgImage"
	LLMSTxt        = "llmsTxt"
	LLMSContent    = "llmsContent"
	Timezone       = "timezone"
	// MediaMaxMB and MediaMaxVideoMB limit uploads to the media library
	// (images and PDFs, videos) in MB; empty means the media library's
	// defaults of 20 and 100 MB.
	MediaMaxMB      = "mediaMaxMB"
	MediaMaxVideoMB = "mediaMaxVideoMB"
)

Field names of the settings type.

View Source
const DefaultTimezone = "Europe/Berlin"

DefaultTimezone is used when the settings name none.

View Source
const MaxMediaMB = 1024

MaxMediaMB is the largest upload limit the settings accept.

View Source
const Type = "settings"

Type is the content type (and slug) of the settings entry.

Variables

This section is empty.

Functions

func ValidBaseURL added in v0.2.0

func ValidBaseURL(s string) bool

ValidBaseURL reports whether s can be the site's base URL: an absolute http(s) URL without credentials, query or fragment. Canonicals, the sitemap and robots.txt are built from it and must be absolute.

func ValidMediaMB added in v0.6.0

func ValidMediaMB(v float64) bool

ValidMediaMB reports whether v can be an upload limit: a whole number of MB from 1 to MaxMediaMB.

Types

type Settings

type Settings struct {
	SiteName       string
	BaseURL        string // without trailing slash
	Language       string
	ServerURL      string // without trailing slash
	DefaultOGImage string
	LLMSTxt        bool
	LLMSContent    string
	// Location is the site's time zone: the admin converts date input with
	// it and templates format dates in it.
	Location *time.Location
	// MediaMaxSize and MediaMaxVideoSize are the upload limits in bytes;
	// 0 if not set (or invalid), which means the media library's defaults.
	MediaMaxSize, MediaMaxVideoSize int64
	Data                            map[string]any
}

Settings of the site. Data holds all fields, including ones plugins add with Extend.

func FromData

func FromData(d map[string]any) Settings

FromData reads settings from entry data.

func Load

func Load(ctx context.Context, st storage.Entries) (Settings, error)

Load returns the published settings; zero values if none were published yet.

Jump to

Keyboard shortcuts

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