On this page
The site's declared author, held as the one Person its structured data names, so every page, the front page and the CV all state the same identity once.
#internal/identity
#internal/identity
Package identity holds the site's declared author, as the one Person its structured data names.
A selfdoc site has one author, declared in selfdoc.json under "author" and required there. Every emitter that needs an identity -- the per-page article's author and publisher, the front page's standalone entity, the CV page's profile -- reads it through this package, so a site states the same Person everywhere and states it once.
What used to happen instead is why the block is required: with no author declared, the emitters minted {"@type": "Organization", "name":
#AuthorKeys
var AuthorKeys = []string{"name", "url", "same_as"}AuthorKeys is every key an "author" block may carry, mirroring the config schema.
#ErrNoDeclaredAuthor
var ErrNoDeclaredAuthor = errors.New(ErrNoDeclaredAuthor is the refusal every entry point returns when the build has no author with both a name and a URL. It names the config key rather than falling back to anything: there is no inferred author.
#Property
type Property structProperty is one property of a JSON-LD entity: its name and its value.
#Entity
type Entity []PropertyEntity is a JSON-LD entity as an ordered property list.
The order is part of the output, not an implementation detail: the emitted structured data is rendered by walking the entity, and a Person reads "@context" (when it stands as its own document), then "@type", "name", "url", "sameAs", then whatever the page contributed. A Go map carries no order, so the entity is a slice.
#PersonEntity
func PersonEntity(author map[string]any, withContext bool, extra Entity) (Entity, error)PersonEntity returns the declared author as a schema.org Person.
withContext adds "@context" for an entity emitted as its own JSON-LD document rather than nested inside one. extra carries the properties only a particular page knows -- a CV's occupation, languages and schools -- and is merged after the identity properties, each entry skipped when its value is empty. An extra whose key is one of the identity properties replaces that property where it already stands, so the property order does not change.
It returns [ErrNoDeclaredAuthor] when no author is declared.
#Entity.Get
func (e Entity) Get(key string) (any, bool)Get returns the value of key and whether the entity carries it.
#Entity.Set
func (e *Entity) Set(key string, value any)Set assigns key, replacing the value in place when the entity already carries that key and appending it at the end otherwise -- the behavior of assigning into a Python dict, which is what the callers of [PersonEntity] were written against.
#Entity.Keys
func (e Entity) Keys() []stringKeys returns the entity's property names in order.