Documentation ¶
Index ¶
- type Context
- func (c *Context) AppendUniqueCategory(newCategory string)
- func (c *Context) AppendUniqueTags(newTags []string)
- func (c Context) ArrayOfPages() (pages []int)
- func (c *Context) Copy() *Context
- func (c Context) FilterByCategory(category string) []file.ParsedFile
- func (c Context) FilterByPage(page int) []file.ParsedFile
- func (c Context) FilterByTag(tag string) []file.ParsedFile
- func (c Context) HumanizeDatetime(datetime time.Time) string
- func (c Context) Len() int
- func (c Context) Less(i, j int) bool
- func (c Context) NextSlug(page int) string
- func (c Context) NumberOfPages() int
- func (c Context) PreviousSlug(page int) (slug string)
- func (c Context) ShowHeader() bool
- func (c Context) Swap(i, j int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Pages []file.ParsedFile Articles []file.ParsedFile Tags, Categories []string Config config.Config Updated string // Temporal stuff for template rendering Article file.ParsedFile Page file.ParsedFile Tag string Category string CurrentPage int // contains filtered or unexported fields }
func (*Context) AppendUniqueCategory ¶
AppendUniqueCategory will append the category just in case that doesn't belong to the Context yet.
func (*Context) AppendUniqueTags ¶
AppendUniqueTags will append the tag only if it's not already on the context.
func (Context) ArrayOfPages ¶
ArrayOfPages is a dirty hack because we can not (or I don't know how) do a range from X to Y on the template
func (Context) FilterByCategory ¶
func (c Context) FilterByCategory(category string) []file.ParsedFile
FilterByCategory returns all the articles belonging to the give category.
func (Context) FilterByPage ¶
func (c Context) FilterByPage(page int) []file.ParsedFile
FilterByPage returns the articles of the site paginated.
func (Context) FilterByTag ¶
func (c Context) FilterByTag(tag string) []file.ParsedFile
FilterByTag returns all the articles belonging to the given tag.
func (Context) HumanizeDatetime ¶
HumanizeDatetime returns a date or datetime depending of the datetime received. For example, if the datetime received doesn't have any hour/minutes, the hours/minutes part doesn't need to be shown.
func (Context) NumberOfPages ¶
func (Context) PreviousSlug ¶
PreviousSlug "calculates" the previous index slug given the page number.