templum

package module
v0.0.0-...-b819d50 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: GPL-3.0 Imports: 27 Imported by: 0

README

templum

A static site generator for templ.

Install

go install github.com/cugu/templum/cmd/templum@latest

Usage

Generate a site from the content folder to the public folder:

templum --content content --output public --user "https://cugu.github.io/templum/"

Content

Content is written in Markdown.

The content directory structure is:

content
├── config.yaml
├── index.md
├── 1 Something.md
├── 2 Something else.md
│   ├── 1 My Topic .md
│   └── 2 My Other Topic.md
├── 3 Another thing.md
└── logo.svg
config.yaml

The config file contains the site base url and the GitHub url:

github_url: "https://github.com/cugu/templum"
logo: "templum.svg"
title: "templum"
Folders and Markdown files

The folder structure is used to create the navigation. Number prefixes are used to order the pages and are removed from the navigation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, baseURL, contentPath string, theme Theme, outputPath string) error

func Markdown

func Markdown(md string) templ.Component

Types

type MemoryFS

type MemoryFS = fstest.MapFS

type MemoryFile

type MemoryFile = fstest.MapFile

type Page

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

func NewMarkdownPage

func NewMarkdownPage(fsys fs.FS, path string) *Page

func NewSectionPage

func NewSectionPage(path string) *Page

func (*Page) AddChildren

func (p *Page) AddChildren(child ...*Page)

func (*Page) Children

func (p *Page) Children() []*Page
func (p *Page) Link() string

func (*Page) Markdown

func (p *Page) Markdown() (string, error)

func (*Page) Order

func (p *Page) Order() int

func (*Page) Title

func (p *Page) Title() string

func (*Page) Type

func (p *Page) Type() PageType

type PageContext

type PageContext struct {
	*SiteContext

	Page *Page
}

type PageType

type PageType int
const (
	Section PageType = iota
	MarkdownPage
)

type SiteContext

type SiteContext struct {
	BaseURL    string
	Config     map[string]string
	Pages      []*Page
	OtherFiles fs.FS
}

type Theme

type Theme interface {
	Render(ctx context.Context, siteContext *SiteContext) (fs.FS, error)
}

Directories

Path Synopsis
cmd
theme
plain
templ: version: v0.2.639
templ: version: v0.2.639

Jump to

Keyboard shortcuts

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