admin

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(cfg *config.Config, sourceDir string, rebuild func(), serveURL string) http.Handler

NewHandler creates an http.Handler for the admin panel (SPA + API). It serves the embedded React app on /admin/ and provides /admin/api/* JSON endpoints.

Types

type APIError

type APIError struct {
	Error string `json:"error"`
}

APIError represents a JSON error response.

type ContentDetail

type ContentDetail struct {
	ContentItem
	RawContent  string                 `json:"rawContent"`
	Frontmatter map[string]interface{} `json:"frontmatter"`
}

ContentDetail is the API response for reading a single file (full detail).

type ContentItem

type ContentItem struct {
	Title       string   `json:"title"`
	RelPath     string   `json:"relPath"`
	FilePath    string   `json:"filePath"`
	Section     string   `json:"section"`
	Kind        string   `json:"kind"`
	Draft       bool     `json:"draft"`
	Hidden      bool     `json:"hidden"`
	Date        string   `json:"date"`
	Tags        []string `json:"tags"`
	Description string   `json:"description"`
	Slug        string   `json:"slug"`
	Language    string   `json:"language"`
	URL         string   `json:"url"`
}

ContentItem is the API response for a single content file.

type ContentListResponse

type ContentListResponse struct {
	Sections map[string][]ContentItem `json:"sections"`
	Tree     []*TreeNode              `json:"tree"`
	Total    int                      `json:"total"`
}

ContentListResponse wraps the content listing.

type CreateContentRequest

type CreateContentRequest struct {
	Section  string `json:"section"`
	Filename string `json:"filename"` // e.g. "my-post" (without .md)
	Title    string `json:"title"`
	Draft    bool   `json:"draft"`
}

CreateContentRequest is the API body for creating a new content file.

type LanguageInfo

type LanguageInfo struct {
	Language string `json:"language"`
	RelPath  string `json:"relPath"`
	Title    string `json:"title"`
	Draft    bool   `json:"draft"`
}

LanguageInfo represents a single language version of a content file.

type ParamsSettings

type ParamsSettings struct {
	SubTitle        string `json:"subTitle" yaml:"subTitle"`
	FooterSlogan    string `json:"footerSlogan" yaml:"footerSlogan"`
	Description     string `json:"description" yaml:"description"`
	Copyrights      string `json:"copyrights" yaml:"copyrights"`
	GoogleAnalytics string `json:"googleAnalytics" yaml:"googleAnalytics"`
	CDNURL          string `json:"cdnURL" yaml:"cdnURL"`
	EnableMathJax   bool   `json:"enableMathJax" yaml:"enableMathJax"`
	EnableSummary   bool   `json:"enableSummary" yaml:"enableSummary"`
}

type SiblingResponse

type SiblingResponse struct {
	Current  string         `json:"current"`
	Siblings []LanguageInfo `json:"siblings"`
}

SiblingResponse wraps the sibling language versions for a content file.

type SiteSettings

type SiteSettings struct {
	Title       string         `json:"title" yaml:"title"`
	EnableEmoji bool           `json:"enableEmoji" yaml:"enableEmoji"`
	Minify      bool           `json:"minify" yaml:"minify"`
	Paginate    int            `json:"paginate" yaml:"paginate"`
	SummaryLen  int            `json:"summaryLength" yaml:"summaryLength"`
	Params      ParamsSettings `json:"params" yaml:"params"`
}

SiteSettings holds the Phase 1 config fields manageable from the admin UI. JSON tags use snake_case for the frontend API.

type StatusResponse

type StatusResponse struct {
	Title            string         `json:"title"`
	BaseURL          string         `json:"baseURL"`
	ServeURL         string         `json:"serveURL"`
	Total            int            `json:"total"`
	Published        int            `json:"published"`
	Drafts           int            `json:"drafts"`
	Sections         int            `json:"sections"`
	Languages        []string       `json:"languages"`
	MediaCount       int            `json:"mediaCount"`
	SectionBreakdown map[string]int `json:"sectionBreakdown"`
	RecentContent    []ContentItem  `json:"recentContent,omitempty"`
}

StatusResponse holds site overview stats for the dashboard.

type TreeNode

type TreeNode struct {
	Name     string      `json:"name"`
	Path     string      `json:"path"`
	Type     string      `json:"type"`  // "folder" or "file"
	Count    int         `json:"count"` // number of content items in this subtree (folders only)
	Children []*TreeNode `json:"children"`
}

TreeNode represents a node in the content directory tree for the admin navigation.

type UpdateContentRequest

type UpdateContentRequest struct {
	Frontmatter map[string]interface{} `json:"frontmatter"`
	RawContent  string                 `json:"rawContent"`
}

UpdateContentRequest is the API body for updating a content file.

Jump to

Keyboard shortcuts

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