docserver

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GoogleAnalyticsTag

func GoogleAnalyticsTag(id string) string

GoogleAnalyticsTag returns the Google Analytics tracking code for the given ID. Returns empty string if id is empty.

Types

type CachedDoc

type CachedDoc struct {
	Doc      *markdown.Document
	ETag     string
	Modified time.Time
}

CachedDoc represents a cached document

type CachedIndex

type CachedIndex struct {
	Data     []byte
	ETag     string
	Modified time.Time
}

CachedIndex represents the cached document index

type DocServer

type DocServer struct {
	// contains filtered or unexported fields
}

DocServer handles markdown document requests

func NewDocServer

func NewDocServer(contentDir, fallbackURL string, indexLimit int, googleAnalyticsID, fediHandle string) *DocServer

NewDocServer creates a new document server fediHandle is optional - if provided, adds a "Follow on Mastodon" button (e.g., "@[email protected]")

func (*DocServer) GetFaviconPath

func (ds *DocServer) GetFaviconPath() string

GetFaviconPath returns the path to favicon if one exists, empty string otherwise

func (*DocServer) GetIndexDocument

func (ds *DocServer) GetIndexDocument() (*markdown.Document, error)

GetIndexDocument returns the parsed index.md document, or nil if not found

func (*DocServer) GetIndexJSONLD

func (ds *DocServer) GetIndexJSONLD() ([]byte, error)

GetIndexJSONLD returns the JSON-LD index data without setting HTTP headers This is used for embedding JSON-LD in HTML pages

func (*DocServer) HandleContentAsset

func (ds *DocServer) HandleContentAsset(w http.ResponseWriter, r *http.Request, filename string)

HandleContentAsset serves static assets (images) from the content directory

func (*DocServer) HandleDoc

func (ds *DocServer) HandleDoc(w http.ResponseWriter, r *http.Request, slug string)

HandleDoc handles GET /posts/:slug - render a single document

func (*DocServer) HandleDocJSONLD

func (ds *DocServer) HandleDocJSONLD(w http.ResponseWriter, r *http.Request, slug string)

HandleDocJSONLD handles GET /posts/:slug.jsonld - return JSON-LD only

func (*DocServer) HandleDocList

func (ds *DocServer) HandleDocList(w http.ResponseWriter, r *http.Request)

HandleDocList handles GET /posts - list all posts

func (*DocServer) HandleFavicon

func (ds *DocServer) HandleFavicon(w http.ResponseWriter, r *http.Request)

HandleFavicon serves favicon from content directory Looks for favicon.ico, favicon.png, or favicon.svg in content parent directory

func (*DocServer) HandleIndexJSONLD

func (ds *DocServer) HandleIndexJSONLD(w http.ResponseWriter, r *http.Request)

HandleIndexJSONLD handles GET /posts/index.jsonld - return collection index

func (*DocServer) HandleRSSList

func (ds *DocServer) HandleRSSList(w http.ResponseWriter, r *http.Request)

HandleRSSList handles GET /rss - return HTML page listing all available RSS feeds

func (*DocServer) HandleSearch

func (ds *DocServer) HandleSearch(w http.ResponseWriter, r *http.Request)

HandleSearch handles GET /search - client-side search page

func (*DocServer) HandleSiteRSS

func (ds *DocServer) HandleSiteRSS(w http.ResponseWriter, r *http.Request)

HandleSiteRSS handles GET /posts.rss - return RSS feed for all blog posts

func (*DocServer) HandleSitemap

func (ds *DocServer) HandleSitemap(w http.ResponseWriter, r *http.Request)

HandleSitemap handles GET /sitemap.xml - return XML sitemap for all pages

func (*DocServer) HandleTagPage

func (ds *DocServer) HandleTagPage(w http.ResponseWriter, r *http.Request, tag string)

HandleTagPage handles GET /tags/{tag} - show posts with a specific tag

func (*DocServer) HandleTagsPage

func (ds *DocServer) HandleTagsPage(w http.ResponseWriter, r *http.Request)

HandleTagsPage handles GET /tags - display word cloud of all tags

func (*DocServer) HandleUserRSS

func (ds *DocServer) HandleUserRSS(w http.ResponseWriter, r *http.Request, userName string)

HandleUserRSS handles GET /u/{user}/posts.rss - return RSS feed for user's blog posts

type DocumentCache

type DocumentCache struct {
	// contains filtered or unexported fields
}

DocumentCache caches rendered documents

type TagInfo

type TagInfo struct {
	Tag   string
	Count int
}

TagInfo represents a tag with its frequency

Jump to

Keyboard shortcuts

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