server

package
v0.0.0-...-8786c70 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_TEMPLATE = "/templates/base.tmpl"
View Source
const BLOG_BASE_PATH = "blog"
View Source
const BLOG_TEMPLATE = "/templates/blog.tmpl"
View Source
const INDEX_TEMPLATE = "/templates/index.tmpl"

Variables

View Source
var LINKS_PATH = "config/links.yml"

Functions

func CopyDirectory

func CopyDirectory(source, dest string) error

func CopyFile

func CopyFile(source, dest string)

func CreateNewMarkdownFile

func CreateNewMarkdownFile(title string, path string)

Types

type BlogMetadata

type BlogMetadata struct {
	Title       string    `yaml:"title"`
	IsPublished bool      `yaml:"published"`
	Date        time.Time `yaml:"date"`
	Slug        string    `yaml:"slug"`
	Tags        []string  `yaml:"tags"`
}

type BlogOption

type BlogOption func(*BlogRenderCache)

func RenderUnpublished

func RenderUnpublished() BlogOption

type BlogPost

type BlogPost struct {
	Slug     string
	Path     string
	Body     string
	Metadata BlogMetadata
}

func (*BlogPost) FormatDate

func (post *BlogPost) FormatDate() string

type BlogRenderCache

type BlogRenderCache struct {
	Prefix                string
	OutputPath            string
	Items                 []BlogPost
	ShouldListUnpublished bool
	Links                 LinkMetadata
	// contains filtered or unexported fields
}

func NewBlogRenderCache

func NewBlogRenderCache(prefix string, opts ...BlogOption) *BlogRenderCache

func (*BlogRenderCache) Render

func (b *BlogRenderCache) Render()

type ExternalPostsMetadata

type ExternalPostsMetadata struct {
	Title string    `yaml:"title"`
	Link  string    `yaml:"link"`
	Date  time.Time `yaml:"date"`
}

func (ExternalPostsMetadata) FormatDate

func (epm ExternalPostsMetadata) FormatDate() string

type IndexTemplateArgs

type IndexTemplateArgs struct {
	Title     string
	Body      string
	BlogItems []BlogPost
	Links     LinkMetadata
}

type LinkMetadata

type LinkMetadata struct {
	Profiles []ProfileMetadata       `yaml:"profiles"`
	External []ExternalPostsMetadata `yaml:"external_posts"`
}
func NewLinks() LinkMetadata

type PostTemplateArgs

type PostTemplateArgs struct {
	Title string
	Body  string
	Links LinkMetadata
}

type ProfileMetadata

type ProfileMetadata struct {
	Title string `yaml:"title"`
	Link  string `yaml:"link"`
}

func (ProfileMetadata) SVGSource

func (pm ProfileMetadata) SVGSource() string

type TemplateRenderer

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

func NewTemplateRenderer

func NewTemplateRenderer(base string) *TemplateRenderer

func (*TemplateRenderer) AddTemplate

func (t *TemplateRenderer) AddTemplate(paths ...string)

func (*TemplateRenderer) Render

func (t *TemplateRenderer) Render(out io.Writer, path string, data any)

Jump to

Keyboard shortcuts

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