From a23ecbfe716a6670c218338455a1a475cdf0dac6 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 8 Jul 2023 22:02:10 +0200 Subject: Added additonal documentation --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/README.md b/README.md index 41fd492..7965c94 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,61 @@ This is my first post. It ain't much but it's an honest post. generator which file in `templates` folder to use and `url` tells generator what the file should be called when its saved. +## Entities available in template + +### Config + +```txt +Config { + Title string + Description string + BaseURL string + Language string + Highlighting string + Minify bool +} +``` + +Using it inside of a template. + +```html +
{{ .Config.Language }}
+``` + +### Page + +```txt +Page { + Filepath string + Raw string + HTML template.HTML + Text string + Summary string + Meta map[string]interface{} + Title string + Type string + RelPermalink string + Created time.Time + Draft bool +} +``` + +Using it inside of a template. + +```html +{{ range .Pages }} + {{ if eq .Type "post" }} +
  • + {{ .Title }} +
    {{ .Created.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}
    +
  • + {{ end }} +{{ end }} +``` + +That `.Format` shenanigas are used for formatting `time.Time` type. You can read +more about it on https://gosamples.dev/date-time-format-cheatsheet/. + ## License [jbmafp](https://github.com/mitjafelicijan/jbmafp) was written by [Mitja -- cgit v1.2.3