Documentation
¶
Overview ¶
Package docs serves goblog's builder documentation — how to write and publish plugins and themes — from markdown embedded in the binary, so a site always documents the version it runs.
Index ¶
- Constants
- type Heading
- type Plugin
- func (p *Plugin) DisplayName() string
- func (p *Plugin) Name() string
- func (p *Plugin) OnInit(db *gorm.DB) error
- func (p *Plugin) Pages() []gplugin.PageDefinition
- func (p *Plugin) RenderPage(ctx *gplugin.HookContext, pageType string) (string, gin.H)
- func (p *Plugin) Search(ctx *gplugin.HookContext, query string) []gplugin.SearchResult
- func (p *Plugin) Settings() []gplugin.SettingDefinition
- func (p *Plugin) Sitemap(ctx *gplugin.HookContext) []gplugin.SitemapURL
- func (p *Plugin) Version() string
Constants ¶
const PageType = "docs"
PageType is the page type this plugin owns.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Plugin ¶
type Plugin struct {
gplugin.BasePlugin
// contains filtered or unexported fields
}
Plugin serves the builder documentation at /docs.
func New ¶
func New() *Plugin
New renders every page. A page that fails to render is a build defect, not a runtime condition, so it panics — the package tests catch it first.
func (*Plugin) DisplayName ¶
func (*Plugin) OnInit ¶
OnInit ensures the page row exists (the registry normally creates it first; this is the fallback). A foreign page or a post type on the "docs" slug is left alone with a log line, as the directory plugin does, so Init continues.
func (*Plugin) Pages ¶
func (p *Plugin) Pages() []gplugin.PageDefinition
func (*Plugin) RenderPage ¶
RenderPage serves the index ("") and one page per slug; anything else is declined so blog answers 404.
func (*Plugin) Search ¶
func (p *Plugin) Search(ctx *gplugin.HookContext, query string) []gplugin.SearchResult
Search answers the site search (plugin.Searcher) with every page whose title or text contains the query — title matches first, then text matches, each in sidebar order — linking under the docs page's current slug.
func (*Plugin) Settings ¶
func (p *Plugin) Settings() []gplugin.SettingDefinition
func (*Plugin) Sitemap ¶
func (p *Plugin) Sitemap(ctx *gplugin.HookContext) []gplugin.SitemapURL
Sitemap lists every docs page but the index (plugin.Sitemapper) under the docs page's current slug; blog lists the page itself.