identity

package
v3.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeWebsite      = "website"
	TypePage         = "page"
	TypeSection      = "section"
	TypeTheme        = "theme"
	TypeTemplate     = "template"
	TypePerson       = "person"
	TypeOrganization = "organization"
	TypeResourceType = "resource-type"
	TypeResource     = "resource"
)

Variables

This section is empty.

Functions

func ExtractEntityType

func ExtractEntityType(id string) string

ExtractEntityType returns the entity type from a URN. 2-part (urn:<slug>) → "website" 5-part with parts[2]=="page" → "page" 5-part with parts[3]=="section" → "section" Non-URN strings return "".

func ExtractKSUID

func ExtractKSUID(id string) string

ExtractKSUID returns the KSUID portion of an entity ID. 2-part (website) → "" 5-part page (urn:<ws>:page:<ksuid>:<ps>) → parts[3] 5-part section (urn:<ws>:<ps>:section:<ksuid>) → parts[4] Non-URN strings are returned as-is.

func ExtractPageSlug

func ExtractPageSlug(id string) string

ExtractPageSlug returns the page slug from a URN. 5-part page (urn:<ws>:page:<ksuid>:<ps>) → parts[4] 5-part section (urn:<ws>:<ps>:section:<ksuid>) → parts[2] Otherwise → ""

func ExtractResourceTypeSlug

func ExtractResourceTypeSlug(id string) string

ExtractResourceTypeSlug returns the type slug from a resource URN. Resource URN format: "urn:<typeSlug>:<ksuid>" → returns typeSlug. Only matches 3-part URNs that don't use reserved prefixes.

func ExtractThemeSlug

func ExtractThemeSlug(id string) string

ExtractThemeSlug returns the theme slug from a theme or template URN. Theme URN (urn:theme:<slug>) → parts[2] Template URN (urn:theme:<ts>:template:<ksuid>:<tps>) → parts[2] Otherwise → ""

func ExtractWebsiteSlug

func ExtractWebsiteSlug(id string) string

ExtractWebsiteSlug returns the website slug from any URN. Returns parts[1] for any valid URN, "" for non-URN.

func NewOrganization

func NewOrganization(slug string) string

NewOrganization generates an organization URN from a slug. Format: "urn:org:<slug>"

func NewPage

func NewPage(websiteSlug, pageSlug string) string

NewPage generates a page URN scoped to a website. Format: "urn:<websiteSlug>:page:<ksuid>:<pageSlug>"

func NewPerson

func NewPerson() string

NewPerson generates a person URN. Format: "urn:person:<ksuid>"

func NewResource

func NewResource(typeSlug string) string

NewResource generates a resource URN scoped to a type slug. Format: "urn:<typeSlug>:<ksuid>"

func NewResourceType

func NewResourceType(slug string) string

NewResourceType generates a resource type URN from a slug. Format: "urn:type:<slug>"

func NewSection

func NewSection(websiteSlug, pageSlug string) string

NewSection generates a section URN scoped to a page within a website. Format: "urn:<websiteSlug>:<pageSlug>:section:<ksuid>"

func NewTemplate

func NewTemplate(themeSlug, templateSlug string) string

NewTemplate generates a template URN scoped to a theme. Format: "urn:theme:<themeSlug>:template:<ksuid>:<templateSlug>"

func NewTheme

func NewTheme(slug string) string

NewTheme generates a theme URN from a slug. Format: "urn:theme:<slug>"

func NewWebsite

func NewWebsite(slug string) string

NewWebsite generates a website URN from a slug. Format: "urn:<slug>"

func Slugify

func Slugify(name string) string

Slugify converts a name into a URL-friendly slug. It lowercases the input, replaces non-alphanumeric characters with hyphens, collapses consecutive hyphens, and trims leading/trailing hyphens.

Types

This section is empty.

Jump to

Keyboard shortcuts

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