shell

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 2 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 shell is the docs-shell registry block (REQ-CNT-06): a layout with a header, a sidebar, a table of contents, pagination and a 404, plus the client behaviours they need.

Index

Constants

This section is empty.

Variables

View Source
var HeaderFixtures = gx.Fixtures[HeaderProps]{
	"Default": {Site: fixtureSite},
}
View Source
var NotFoundFixtures = gx.Fixtures[NotFoundProps]{
	"Default": {},
}
View Source
var PageMetaFixtures = gx.Fixtures[PageMetaProps]{
	"Default": {Site: fixtureSite, Page: fixturePage},
	"Plain":   {Site: Config{Title: "Site"}, Page: Page{Title: "Page", Path: "/page/"}},
}
View Source
var PaginationFixtures = gx.Fixtures[PaginationProps]{
	"Both":  {Prev: &NavItem{Label: "Start", Href: gx.URL("/start/")}, Next: fixtureNext},
	"Next":  {Next: fixtureNext},
	"Empty": {},
}
View Source
var SearchDialogFixtures = gx.Fixtures[SearchDialogProps]{
	"Default": {},
}
View Source
var ShellFixtures = gx.Fixtures[ShellProps]{
	"Default": {Site: fixtureSite, Nav: fixtureNav, Page: fixturePage, Children: gx.Text("Body.")},
}
View Source
var SidebarFixtures = gx.Fixtures[SidebarProps]{
	"Default": {Nav: fixtureNav, Path: "/guides/routing/pages/"},
}
View Source
var SidebarGroupFixtures = gx.Fixtures[SidebarGroupProps]{
	"Default": {Group: fixtureStart, Path: "/start/"},
	"Nested":  {Group: fixtureGuides, Path: "/guides/routing/pages/"},
}
View Source
var SidebarItemFixtures = gx.Fixtures[SidebarItemProps]{
	"Link":   {Item: NavItem{Label: "Routing", Href: gx.URL("/guides/routing/")}, Path: "/guides/routing/"},
	"Nested": {Item: fixtureRouting, Path: "/guides/routing/pages/"},
}
View Source
var SplashFixtures = gx.Fixtures[SplashProps]{
	"Default": {Title: "Deedbox", Tagline: "Event sourcing in .NET.", Actions: gx.Text("Docs")},
	"Plain":   {Title: "Deedbox"},
}
View Source
var ThemeSelectFixtures = gx.Fixtures[ThemeSelectProps]{
	"Default": {},
}
View Source
var TocFixtures = gx.Fixtures[TocProps]{
	"Default": {Headings: fixtureHeadings},
}

Functions

func Active

func Active(path string, href string) bool

Active reports whether href is the current page or a parent of it (REQ-CNT-06). The sidebar marks active items on the server.

func ActiveItem

func ActiveItem(path string, item NavItem) bool

ActiveItem reports whether any descendant of item is active.

func Header(p HeaderProps) gx.Node

func NotFound

func NotFound(p NotFoundProps) gx.Node

func PageMeta

func PageMeta(p PageMetaProps) gx.Node

func Pagination

func Pagination(p PaginationProps) gx.Node

func SearchDialog

func SearchDialog(p SearchDialogProps) gx.Node

func Shell

func Shell(p ShellProps) gx.Node
func Sidebar(p SidebarProps) gx.Node

func SidebarGroup

func SidebarGroup(p SidebarGroupProps) gx.Node

func SidebarItem

func SidebarItem(p SidebarItemProps) gx.Node

func Splash

func Splash(p SplashProps) gx.Node

func ThemeSelect

func ThemeSelect(p ThemeSelectProps) gx.Node

func Toc

func Toc(p TocProps) gx.Node

Types

type Config

type Config struct {
	Title   string
	Version string
	Links   []Link
	// EditBase is the repository edit URL up to the file path, for example
	// https://github.com/acme/site/edit/main/content/docs/. Empty hides
	// the edit link.
	EditBase string
}

Config is the site-wide shell data (REQ-CNT-06).

func (Config) EditURL

func (c Config) EditURL(p Page) string

EditURL returns the edit-page link of the page (REQ-CNT-06). The page path maps to its Markdown file: "/start/" to "start.md".

type HeaderProps

type HeaderProps struct {
	// Site is the site-wide data: the title, the version and the header links.
	Site Config
}

type Heading

type Heading struct {
	Level int
	Text  string
	ID    string
}

Heading is one table-of-contents entry (REQ-CNT-06).

type Link struct {
	Label string
	Href  gx.URL
}

Link is one header link: a social link or a plain link.

type Nav struct {
	Groups []NavGroup
}

Nav is the sidebar model (REQ-CNT-06).

type NavGroup struct {
	Label     string
	Badge     string
	Collapsed bool
	Items     []NavItem
}

NavGroup is one sidebar section. A group with Collapsed starts closed.

type NavItem struct {
	Label string
	Href  gx.URL
	Badge string
	Items []NavItem
}

NavItem is one sidebar link. Items nest under a parent item.

type NotFoundProps

type NotFoundProps struct {
	// Title is the heading of the page.
	Title string
	// Message is the text below the title.
	Message string
	// Home is the target of the Go home link.
	Home string
}

type Page

type Page struct {
	Title string
	// Path is the site path of the page, for example /start/.
	Path string
	// Section is the sidebar group label of the page.
	Section string
	// Updated is the last-updated text. Empty hides it.
	Updated string
	// Prev and Next are the previous and next sidebar items.
	Prev *NavItem
	Next *NavItem
	// TOC holds the page headings, in document order.
	TOC []Heading
	// Depth limits the table of contents to headings at or below this
	// level. Zero means 3.
	Depth int
}

Page is the shell data of one page (REQ-CNT-06).

func (Page) HasTOC

func (p Page) HasTOC() bool

HasTOC reports whether the page has headings to show.

func (Page) ShownTOC

func (p Page) ShownTOC() []Heading

ShownTOC returns the headings the table of contents shows.

func (Page) TocDepth

func (p Page) TocDepth() int

TocDepth returns the heading depth limit of the page.

type PageMetaProps

type PageMetaProps struct {
	// Site is the site-wide data. Its EditBase builds the edit link; empty hides the link.
	Site Config
	// Page is the data of the current page: its path and its last-updated text.
	Page Page
}

type PaginationProps

type PaginationProps struct {
	// Prev is the previous sidebar item. Nil omits the link.
	Prev *NavItem
	// Next is the next sidebar item. Nil omits the link.
	Next *NavItem
}

type SearchDialogProps

type SearchDialogProps struct {
}

type ShellProps

type ShellProps struct {
	// Site is the site-wide data: the title, the version and the header links.
	Site Config
	// Nav is the sidebar model: the groups and their items.
	Nav Nav
	// Page is the data of the current page: its path, its headings and its previous and next
	// items.
	Page Page
	// Children is the content of the page.
	Children gx.Node
}

type SidebarGroupProps

type SidebarGroupProps struct {
	// Group is the sidebar section: its label, its badge and its items.
	// A group with Collapsed starts closed.
	Group NavGroup
	// Path is the site path of the current page.
	// A nested item that holds the page starts open.
	Path string
}

type SidebarItemProps

type SidebarItemProps struct {
	// Item is the sidebar link. An item with nested items shows as a collapsible list.
	Item NavItem
	// Path is the site path of the current page.
	// A nested item that holds the page starts open.
	Path string
}

type SidebarProps

type SidebarProps struct {
	// Nav is the sidebar model: the groups and their items.
	Nav Nav
	// Path is the site path of the current page.
	// A nested item that holds the page starts open.
	Path string
}

type SplashProps

type SplashProps struct {
	// Title is the heading of the splash.
	Title string
	// Tagline is the text below the title. Empty omits it.
	Tagline string
	// Actions is the row of links or buttons below the tagline. Nil omits it.
	Actions gx.Node
	// Children is the content below the actions. Nil omits it.
	Children gx.Node
}

type ThemeSelectProps

type ThemeSelectProps struct {
}

type TocProps

type TocProps struct {
	// Headings holds the entries of the table of contents. Empty renders nothing.
	Headings []Heading
}

Jump to

Keyboard shortcuts

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