Added additonal documentation
| 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) |
|
-rw-r--r-- |
README.md | 55 |
1 files changed, 55 insertions, 0 deletions
| diff --git a/README.md b/README.md | |||
| ... | |||
| 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 |
| ... | |||