content

package
v0.0.0-...-3eee703 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// All possible content types
	ContentTypes = []string{"experience", "education", "projects", "certifications", "bio"}
)

Functions

func GetRoutingRegexString

func GetRoutingRegexString() string

GetRoutingRegexString returns the regex which catches the endpoints for the content types as string

func IsValidContentType

func IsValidContentType(contentType string) bool

IsValidContentType returns if the content type passed is a valid one

Types

type AboutMeConfig

type AboutMeConfig struct {
	AboutMe template.HTML `yaml:"me"`
}

func (*AboutMeConfig) ConfigName

func (a *AboutMeConfig) ConfigName() string

func (*AboutMeConfig) ContentType

func (a *AboutMeConfig) ContentType() string

func (*AboutMeConfig) Render

func (a *AboutMeConfig) Render() (*template.HTML, error)

func (*AboutMeConfig) Title

func (a *AboutMeConfig) Title() string

type Card

type Card interface {
	// CardTemplateName returns the name of the corresponding card html template
	CardTemplateName() string
}

Card defines an element which will be rendered as a card

type CardBase

type CardBase struct {
	// Image to render in the card
	Image string `yaml:"image"`
	// Name to display in the heading
	Name string `yaml:"name"`
	// Link to external content
	Link string `yaml:"link"`
	// Description displayed in the card body
	Description template.HTML `yaml:"description"`
}

CardBase contains shared attributes for all card content types

type CardContentConfig

type CardContentConfig interface {
	// Elements returns the elements loaded from the corresponding yaml file
	// Each of those will be rendered in its own card
	Elements() []Card
}

CardContentConfig defines a specific type of content config, which contains a list of elements to be renderer as bootstrap cards

type CardDateRange

type CardDateRange struct {
	// From a date
	From time.Time `yaml:"from"`
	// To, may be string or date format
	To interface{} `yaml:"to"`
	// The format in which the date is present and should be rendered
	Format string `yaml:"dateformat"`
}

CardDateRange specifies a range of two dates

func (*CardDateRange) GetFromDateAsStr

func (d *CardDateRange) GetFromDateAsStr() string

GetFromDateAsStr returns the date formatted as string

func (*CardDateRange) GetToDateAsStr

func (d *CardDateRange) GetToDateAsStr() string

GetToDateAsStr checks if to date is a date and formats if not a date the string content is returned, if not set this defaults to 'now'

type CertificationCard

type CertificationCard struct {
	CardBase      `yaml:",inline"`
	CardDateRange `yaml:",inline"`
}

func (*CertificationCard) CardTemplateName

func (c *CertificationCard) CardTemplateName() string

type CertificationConfig

type CertificationConfig struct {
	Certifications []*CertificationCard `yaml:"certifications"`
}

func (*CertificationConfig) ConfigName

func (cc *CertificationConfig) ConfigName() string

func (*CertificationConfig) ContentType

func (cc *CertificationConfig) ContentType() string

func (*CertificationConfig) Elements

func (cc *CertificationConfig) Elements() []Card

func (*CertificationConfig) Render

func (cc *CertificationConfig) Render() (*template.HTML, error)

func (*CertificationConfig) Title

func (cc *CertificationConfig) Title() string

type ContentConfig

type ContentConfig interface {
	// ConfigName returns the name of the corresponding yaml config file
	ConfigName() string
	// ContentType returns the type of content this object contains
	ContentType() string
	// Title returns the title of the content which can be used in the templates
	Title() string
	// Render returns the rendered html to be placed in the content template
	Render() (*template.HTML, error)
}

ContentConfig interface which represents a configuration of a content

type ContentTemplateData

type ContentTemplateData struct {
	Title string
	HTML  *template.HTML
}

ContentTemplateData the data which must be passed to the content html templates

func GetRenderedContent

func GetRenderedContent(contentType string) (*ContentTemplateData, error)

GetRenderedContent reads the content kind passed from its yaml configuration and returns all configured elements as html to be placed in the main template directly

type EducationCard

type EducationCard struct {
	CardBase       `yaml:",inline"`
	School         string `yaml:"school"`
	Specialization string `yaml:"specialization"`
	CardDateRange  `yaml:",inline"`
}

func (*EducationCard) CardTemplateName

func (e *EducationCard) CardTemplateName() string

type EducationConfig

type EducationConfig struct {
	Educations []*EducationCard `yaml:"educations"`
}

func (*EducationConfig) ConfigName

func (ec *EducationConfig) ConfigName() string

func (*EducationConfig) ContentType

func (ec *EducationConfig) ContentType() string

func (*EducationConfig) Elements

func (ec *EducationConfig) Elements() []Card

func (*EducationConfig) Render

func (ec *EducationConfig) Render() (*template.HTML, error)

func (*EducationConfig) Title

func (ec *EducationConfig) Title() string

type ExperienceCard

type ExperienceCard struct {
	CardBase      `yaml:",inline"`
	Company       string `yaml:"company"`
	CardDateRange `yaml:",inline"`
}

func (*ExperienceCard) CardTemplateName

func (e *ExperienceCard) CardTemplateName() string

type ExperienceConfig

type ExperienceConfig struct {
	Experiences []*ExperienceCard `yaml:"experiences"`
}

func (*ExperienceConfig) ConfigName

func (ec *ExperienceConfig) ConfigName() string

func (*ExperienceConfig) ContentType

func (ec *ExperienceConfig) ContentType() string

func (*ExperienceConfig) Elements

func (ec *ExperienceConfig) Elements() []Card

func (*ExperienceConfig) Render

func (ec *ExperienceConfig) Render() (*template.HTML, error)

func (*ExperienceConfig) Title

func (ec *ExperienceConfig) Title() string

type ProjectCard

type ProjectCard struct {
	CardBase `yaml:",inline"`
}

func (*ProjectCard) CardTemplateName

func (p *ProjectCard) CardTemplateName() string

type ProjectConfig

type ProjectConfig struct {
	Projects []*ProjectCard `yaml:"projects"`
}

func (*ProjectConfig) ConfigName

func (pc *ProjectConfig) ConfigName() string

func (*ProjectConfig) ContentType

func (pc *ProjectConfig) ContentType() string

func (*ProjectConfig) Elements

func (pc *ProjectConfig) Elements() []Card

func (*ProjectConfig) Render

func (pc *ProjectConfig) Render() (*template.HTML, error)

func (*ProjectConfig) Title

func (pc *ProjectConfig) Title() string

Jump to

Keyboard shortcuts

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