diff options
| author | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-08 22:02:10 +0200 |
|---|---|---|
| committer | Mitja Felicijan <m@mitjafelicijan.com> | 2023-07-08 22:02:10 +0200 |
| commit | a23ecbfe716a6670c218338455a1a475cdf0dac6 (patch) | |
| tree | c1b40c12a0015a7c14ea21717ce2ea1316186b9f /README.md | |
| parent | 47742e9fcaec60798f7d67202e4fa0c25c64b3a1 (diff) | |
| download | jbmafp-a23ecbfe716a6670c218338455a1a475cdf0dac6.tar.gz | |
Added additonal documentation
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 55 |
1 files changed, 55 insertions, 0 deletions
| @@ -89,6 +89,61 @@ This is my first post. It ain't much but it's an honest post. | |||
| 89 | generator which file in `templates` folder to use and `url` tells generator | 89 | generator which file in `templates` folder to use and `url` tells generator |
| 90 | what the file should be called when its saved. | 90 | what the file should be called when its saved. |
| 91 | 91 | ||
| 92 | ## Entities available in template | ||
| 93 | |||
| 94 | ### Config | ||
| 95 | |||
| 96 | ```txt | ||
| 97 | Config { | ||
| 98 | Title string | ||
| 99 | Description string | ||
| 100 | BaseURL string | ||
| 101 | Language string | ||
| 102 | Highlighting string | ||
| 103 | Minify bool | ||
| 104 | } | ||
| 105 | ``` | ||
| 106 | |||
| 107 | Using it inside of a template. | ||
| 108 | |||
| 109 | ```html | ||
| 110 | <div>{{ .Config.Language }}</div> | ||
| 111 | ``` | ||
| 112 | |||
| 113 | ### Page | ||
| 114 | |||
| 115 | ```txt | ||
| 116 | Page { | ||
| 117 | Filepath string | ||
| 118 | Raw string | ||
| 119 | HTML template.HTML | ||
| 120 | Text string | ||
| 121 | Summary string | ||
| 122 | Meta map[string]interface{} | ||
| 123 | Title string | ||
| 124 | Type string | ||
| 125 | RelPermalink string | ||
| 126 | Created time.Time | ||
| 127 | Draft bool | ||
| 128 | } | ||
| 129 | ``` | ||
| 130 | |||
| 131 | Using it inside of a template. | ||
| 132 | |||
| 133 | ```html | ||
| 134 | {{ range .Pages }} | ||
| 135 | {{ if eq .Type "post" }} | ||
| 136 | <li> | ||
| 137 | <a href="/{{ .RelPermalink }}">{{ .Title }}</a> | ||
| 138 | <div>{{ .Created.Format "Mon, 02 Jan 2006 15:04:05 -0700" }}</div> | ||
| 139 | </li> | ||
| 140 | {{ end }} | ||
| 141 | {{ end }} | ||
| 142 | ``` | ||
| 143 | |||
| 144 | That `.Format` shenanigas are used for formatting `time.Time` type. You can read | ||
| 145 | more about it on https://gosamples.dev/date-time-format-cheatsheet/. | ||
| 146 | |||
| 92 | ## License | 147 | ## License |
| 93 | 148 | ||
| 94 | [jbmafp](https://github.com/mitjafelicijan/jbmafp) was written by [Mitja | 149 | [jbmafp](https://github.com/mitjafelicijan/jbmafp) was written by [Mitja |
