| 1 | // Code generated by templ - DO NOT EDIT. |
| 2 | |
| 3 | // templ: version: v0.3.1001 |
| 4 | package main |
| 5 | |
| 6 | //lint:file-ignore SA4006 This context is only used if a nested component is present. |
| 7 | |
| 8 | import "github.com/a-h/templ" |
| 9 | import templruntime "github.com/a-h/templ/runtime" |
| 10 | |
| 11 | // Each public view has a meta component (kept in the layout's <head>) and a |
| 12 | // body component. The body can be replaced by a custom html/template from |
| 13 | // /admin/templates; the starters/*.html files mirror these defaults. |
| 14 | func postItem(p Post, class string) templ.Component { |
| 15 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 16 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 17 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 18 | return templ_7745c5c3_CtxErr |
| 19 | } |
| 20 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 21 | if !templ_7745c5c3_IsBuffer { |
| 22 | defer func() { |
| 23 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 24 | if templ_7745c5c3_Err == nil { |
| 25 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 26 | } |
| 27 | }() |
| 28 | } |
| 29 | ctx = templ.InitializeContext(ctx) |
| 30 | templ_7745c5c3_Var1 := templ.GetChildren(ctx) |
| 31 | if templ_7745c5c3_Var1 == nil { |
| 32 | templ_7745c5c3_Var1 = templ.NopComponent |
| 33 | } |
| 34 | ctx = templ.ClearChildren(ctx) |
| 35 | var templ_7745c5c3_Var2 = []any{class} |
| 36 | templ_7745c5c3_Err = templ.RenderCSSItems(ctx, templ_7745c5c3_Buffer, templ_7745c5c3_Var2...) |
| 37 | if templ_7745c5c3_Err != nil { |
| 38 | return templ_7745c5c3_Err |
| 39 | } |
| 40 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<a href=\"") |
| 41 | if templ_7745c5c3_Err != nil { |
| 42 | return templ_7745c5c3_Err |
| 43 | } |
| 44 | var templ_7745c5c3_Var3 templ.SafeURL |
| 45 | templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinURLErrs(templ.URL("/posts/" + p.Slug)) |
| 46 | if templ_7745c5c3_Err != nil { |
| 47 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 8, Col: 40} |
| 48 | } |
| 49 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) |
| 50 | if templ_7745c5c3_Err != nil { |
| 51 | return templ_7745c5c3_Err |
| 52 | } |
| 53 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "\" class=\"") |
| 54 | if templ_7745c5c3_Err != nil { |
| 55 | return templ_7745c5c3_Err |
| 56 | } |
| 57 | var templ_7745c5c3_Var4 string |
| 58 | templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(templ.CSSClasses(templ_7745c5c3_Var2).String()) |
| 59 | if templ_7745c5c3_Err != nil { |
| 60 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 1, Col: 0} |
| 61 | } |
| 62 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) |
| 63 | if templ_7745c5c3_Err != nil { |
| 64 | return templ_7745c5c3_Err |
| 65 | } |
| 66 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "\"><div class=\"post-item-info\"><span class=\"post-title\">") |
| 67 | if templ_7745c5c3_Err != nil { |
| 68 | return templ_7745c5c3_Err |
| 69 | } |
| 70 | var templ_7745c5c3_Var5 string |
| 71 | templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(p.DisplayTitle()) |
| 72 | if templ_7745c5c3_Err != nil { |
| 73 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 10, Col: 46} |
| 74 | } |
| 75 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) |
| 76 | if templ_7745c5c3_Err != nil { |
| 77 | return templ_7745c5c3_Err |
| 78 | } |
| 79 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</span></div>") |
| 80 | if templ_7745c5c3_Err != nil { |
| 81 | return templ_7745c5c3_Err |
| 82 | } |
| 83 | if p.PublishedDate != nil { |
| 84 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<time class=\"post-date\">") |
| 85 | if templ_7745c5c3_Err != nil { |
| 86 | return templ_7745c5c3_Err |
| 87 | } |
| 88 | var templ_7745c5c3_Var6 string |
| 89 | templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(p.PublishedDateStr()) |
| 90 | if templ_7745c5c3_Err != nil { |
| 91 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 13, Col: 49} |
| 92 | } |
| 93 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) |
| 94 | if templ_7745c5c3_Err != nil { |
| 95 | return templ_7745c5c3_Err |
| 96 | } |
| 97 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</time>") |
| 98 | if templ_7745c5c3_Err != nil { |
| 99 | return templ_7745c5c3_Err |
| 100 | } |
| 101 | } |
| 102 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "</a>") |
| 103 | if templ_7745c5c3_Err != nil { |
| 104 | return templ_7745c5c3_Err |
| 105 | } |
| 106 | return nil |
| 107 | }) |
| 108 | } |
| 109 | |
| 110 | func latestPosts(posts []Post) templ.Component { |
| 111 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 112 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 113 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 114 | return templ_7745c5c3_CtxErr |
| 115 | } |
| 116 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 117 | if !templ_7745c5c3_IsBuffer { |
| 118 | defer func() { |
| 119 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 120 | if templ_7745c5c3_Err == nil { |
| 121 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 122 | } |
| 123 | }() |
| 124 | } |
| 125 | ctx = templ.InitializeContext(ctx) |
| 126 | templ_7745c5c3_Var7 := templ.GetChildren(ctx) |
| 127 | if templ_7745c5c3_Var7 == nil { |
| 128 | templ_7745c5c3_Var7 = templ.NopComponent |
| 129 | } |
| 130 | ctx = templ.ClearChildren(ctx) |
| 131 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<div class=\"post-list\">") |
| 132 | if templ_7745c5c3_Err != nil { |
| 133 | return templ_7745c5c3_Err |
| 134 | } |
| 135 | for _, p := range posts { |
| 136 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "<a href=\"") |
| 137 | if templ_7745c5c3_Err != nil { |
| 138 | return templ_7745c5c3_Err |
| 139 | } |
| 140 | var templ_7745c5c3_Var8 templ.SafeURL |
| 141 | templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinURLErrs(templ.URL("/posts/" + p.Slug)) |
| 142 | if templ_7745c5c3_Err != nil { |
| 143 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 21, Col: 42} |
| 144 | } |
| 145 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) |
| 146 | if templ_7745c5c3_Err != nil { |
| 147 | return templ_7745c5c3_Err |
| 148 | } |
| 149 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "\" class=\"post-item\"><div class=\"post-item-info\"><span class=\"post-title\">") |
| 150 | if templ_7745c5c3_Err != nil { |
| 151 | return templ_7745c5c3_Err |
| 152 | } |
| 153 | var templ_7745c5c3_Var9 string |
| 154 | templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(p.DisplayTitle()) |
| 155 | if templ_7745c5c3_Err != nil { |
| 156 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 23, Col: 48} |
| 157 | } |
| 158 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) |
| 159 | if templ_7745c5c3_Err != nil { |
| 160 | return templ_7745c5c3_Err |
| 161 | } |
| 162 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 11, "</span> ") |
| 163 | if templ_7745c5c3_Err != nil { |
| 164 | return templ_7745c5c3_Err |
| 165 | } |
| 166 | if tags := p.TagList(); len(tags) > 0 { |
| 167 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "<span class=\"post-tags\">") |
| 168 | if templ_7745c5c3_Err != nil { |
| 169 | return templ_7745c5c3_Err |
| 170 | } |
| 171 | for _, t := range tags { |
| 172 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "<span class=\"tag\">") |
| 173 | if templ_7745c5c3_Err != nil { |
| 174 | return templ_7745c5c3_Err |
| 175 | } |
| 176 | var templ_7745c5c3_Var10 string |
| 177 | templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(t) |
| 178 | if templ_7745c5c3_Err != nil { |
| 179 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 27, Col: 29} |
| 180 | } |
| 181 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) |
| 182 | if templ_7745c5c3_Err != nil { |
| 183 | return templ_7745c5c3_Err |
| 184 | } |
| 185 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "</span>") |
| 186 | if templ_7745c5c3_Err != nil { |
| 187 | return templ_7745c5c3_Err |
| 188 | } |
| 189 | } |
| 190 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 15, "</span>") |
| 191 | if templ_7745c5c3_Err != nil { |
| 192 | return templ_7745c5c3_Err |
| 193 | } |
| 194 | } |
| 195 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "</div>") |
| 196 | if templ_7745c5c3_Err != nil { |
| 197 | return templ_7745c5c3_Err |
| 198 | } |
| 199 | if p.PublishedDate != nil { |
| 200 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "<time class=\"post-date\">") |
| 201 | if templ_7745c5c3_Err != nil { |
| 202 | return templ_7745c5c3_Err |
| 203 | } |
| 204 | var templ_7745c5c3_Var11 string |
| 205 | templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(p.PublishedDateStr()) |
| 206 | if templ_7745c5c3_Err != nil { |
| 207 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 33, Col: 51} |
| 208 | } |
| 209 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) |
| 210 | if templ_7745c5c3_Err != nil { |
| 211 | return templ_7745c5c3_Err |
| 212 | } |
| 213 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 18, "</time>") |
| 214 | if templ_7745c5c3_Err != nil { |
| 215 | return templ_7745c5c3_Err |
| 216 | } |
| 217 | } |
| 218 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 19, "</a>") |
| 219 | if templ_7745c5c3_Err != nil { |
| 220 | return templ_7745c5c3_Err |
| 221 | } |
| 222 | } |
| 223 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 20, "</div>") |
| 224 | if templ_7745c5c3_Err != nil { |
| 225 | return templ_7745c5c3_Err |
| 226 | } |
| 227 | return nil |
| 228 | }) |
| 229 | } |
| 230 | |
| 231 | func indexMeta(v indexView) templ.Component { |
| 232 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 233 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 234 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 235 | return templ_7745c5c3_CtxErr |
| 236 | } |
| 237 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 238 | if !templ_7745c5c3_IsBuffer { |
| 239 | defer func() { |
| 240 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 241 | if templ_7745c5c3_Err == nil { |
| 242 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 243 | } |
| 244 | }() |
| 245 | } |
| 246 | ctx = templ.InitializeContext(ctx) |
| 247 | templ_7745c5c3_Var12 := templ.GetChildren(ctx) |
| 248 | if templ_7745c5c3_Var12 == nil { |
| 249 | templ_7745c5c3_Var12 = templ.NopComponent |
| 250 | } |
| 251 | ctx = templ.ClearChildren(ctx) |
| 252 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 21, "<meta name=\"description\" content=\"") |
| 253 | if templ_7745c5c3_Err != nil { |
| 254 | return templ_7745c5c3_Err |
| 255 | } |
| 256 | var templ_7745c5c3_Var13 string |
| 257 | templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(v.BlogDescription) |
| 258 | if templ_7745c5c3_Err != nil { |
| 259 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 41, Col: 53} |
| 260 | } |
| 261 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13)) |
| 262 | if templ_7745c5c3_Err != nil { |
| 263 | return templ_7745c5c3_Err |
| 264 | } |
| 265 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 22, "\"><meta property=\"og:title\" content=\"") |
| 266 | if templ_7745c5c3_Err != nil { |
| 267 | return templ_7745c5c3_Err |
| 268 | } |
| 269 | var templ_7745c5c3_Var14 string |
| 270 | templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(v.BlogTitle) |
| 271 | if templ_7745c5c3_Err != nil { |
| 272 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 42, Col: 48} |
| 273 | } |
| 274 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) |
| 275 | if templ_7745c5c3_Err != nil { |
| 276 | return templ_7745c5c3_Err |
| 277 | } |
| 278 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 23, "\"><meta property=\"og:description\" content=\"") |
| 279 | if templ_7745c5c3_Err != nil { |
| 280 | return templ_7745c5c3_Err |
| 281 | } |
| 282 | var templ_7745c5c3_Var15 string |
| 283 | templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(v.BlogDescription) |
| 284 | if templ_7745c5c3_Err != nil { |
| 285 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 43, Col: 60} |
| 286 | } |
| 287 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) |
| 288 | if templ_7745c5c3_Err != nil { |
| 289 | return templ_7745c5c3_Err |
| 290 | } |
| 291 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 24, "\"><meta property=\"og:type\" content=\"website\"><meta property=\"og:url\" content=\"") |
| 292 | if templ_7745c5c3_Err != nil { |
| 293 | return templ_7745c5c3_Err |
| 294 | } |
| 295 | var templ_7745c5c3_Var16 string |
| 296 | templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(v.SiteURL) |
| 297 | if templ_7745c5c3_Err != nil { |
| 298 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 45, Col: 44} |
| 299 | } |
| 300 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) |
| 301 | if templ_7745c5c3_Err != nil { |
| 302 | return templ_7745c5c3_Err |
| 303 | } |
| 304 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 25, "\">") |
| 305 | if templ_7745c5c3_Err != nil { |
| 306 | return templ_7745c5c3_Err |
| 307 | } |
| 308 | templ_7745c5c3_Err = ogImage(v.siteContext).Render(ctx, templ_7745c5c3_Buffer) |
| 309 | if templ_7745c5c3_Err != nil { |
| 310 | return templ_7745c5c3_Err |
| 311 | } |
| 312 | return nil |
| 313 | }) |
| 314 | } |
| 315 | |
| 316 | func indexBody(v indexView) templ.Component { |
| 317 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 318 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 319 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 320 | return templ_7745c5c3_CtxErr |
| 321 | } |
| 322 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 323 | if !templ_7745c5c3_IsBuffer { |
| 324 | defer func() { |
| 325 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 326 | if templ_7745c5c3_Err == nil { |
| 327 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 328 | } |
| 329 | }() |
| 330 | } |
| 331 | ctx = templ.InitializeContext(ctx) |
| 332 | templ_7745c5c3_Var17 := templ.GetChildren(ctx) |
| 333 | if templ_7745c5c3_Var17 == nil { |
| 334 | templ_7745c5c3_Var17 = templ.NopComponent |
| 335 | } |
| 336 | ctx = templ.ClearChildren(ctx) |
| 337 | if v.IntroHTML != "" { |
| 338 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 26, "<article class=\"intro markdown-body\">") |
| 339 | if templ_7745c5c3_Err != nil { |
| 340 | return templ_7745c5c3_Err |
| 341 | } |
| 342 | templ_7745c5c3_Err = templ.Raw(string(v.IntroHTML)).Render(ctx, templ_7745c5c3_Buffer) |
| 343 | if templ_7745c5c3_Err != nil { |
| 344 | return templ_7745c5c3_Err |
| 345 | } |
| 346 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 27, "</article>") |
| 347 | if templ_7745c5c3_Err != nil { |
| 348 | return templ_7745c5c3_Err |
| 349 | } |
| 350 | } |
| 351 | if len(v.Posts) == 0 { |
| 352 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 28, "<p class=\"empty\">no posts yet</p>") |
| 353 | if templ_7745c5c3_Err != nil { |
| 354 | return templ_7745c5c3_Err |
| 355 | } |
| 356 | } |
| 357 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 29, "<div class=\"post-list\">") |
| 358 | if templ_7745c5c3_Err != nil { |
| 359 | return templ_7745c5c3_Err |
| 360 | } |
| 361 | for _, p := range v.Posts { |
| 362 | templ_7745c5c3_Err = postItem(p, "post-item").Render(ctx, templ_7745c5c3_Buffer) |
| 363 | if templ_7745c5c3_Err != nil { |
| 364 | return templ_7745c5c3_Err |
| 365 | } |
| 366 | } |
| 367 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 30, "</div>") |
| 368 | if templ_7745c5c3_Err != nil { |
| 369 | return templ_7745c5c3_Err |
| 370 | } |
| 371 | return nil |
| 372 | }) |
| 373 | } |
| 374 | |
| 375 | func postsMeta(v postsView) templ.Component { |
| 376 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 377 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 378 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 379 | return templ_7745c5c3_CtxErr |
| 380 | } |
| 381 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 382 | if !templ_7745c5c3_IsBuffer { |
| 383 | defer func() { |
| 384 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 385 | if templ_7745c5c3_Err == nil { |
| 386 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 387 | } |
| 388 | }() |
| 389 | } |
| 390 | ctx = templ.InitializeContext(ctx) |
| 391 | templ_7745c5c3_Var18 := templ.GetChildren(ctx) |
| 392 | if templ_7745c5c3_Var18 == nil { |
| 393 | templ_7745c5c3_Var18 = templ.NopComponent |
| 394 | } |
| 395 | ctx = templ.ClearChildren(ctx) |
| 396 | templ_7745c5c3_Err = ogImage(v.siteContext).Render(ctx, templ_7745c5c3_Buffer) |
| 397 | if templ_7745c5c3_Err != nil { |
| 398 | return templ_7745c5c3_Err |
| 399 | } |
| 400 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 31, "<meta property=\"og:url\" content=\"") |
| 401 | if templ_7745c5c3_Err != nil { |
| 402 | return templ_7745c5c3_Err |
| 403 | } |
| 404 | var templ_7745c5c3_Var19 string |
| 405 | templ_7745c5c3_Var19, templ_7745c5c3_Err = templ.JoinStringErrs(v.SiteURL + "/posts") |
| 406 | if templ_7745c5c3_Err != nil { |
| 407 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 67, Col: 55} |
| 408 | } |
| 409 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var19)) |
| 410 | if templ_7745c5c3_Err != nil { |
| 411 | return templ_7745c5c3_Err |
| 412 | } |
| 413 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 32, "\">") |
| 414 | if templ_7745c5c3_Err != nil { |
| 415 | return templ_7745c5c3_Err |
| 416 | } |
| 417 | return nil |
| 418 | }) |
| 419 | } |
| 420 | |
| 421 | func postsBody(v postsView) templ.Component { |
| 422 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 423 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 424 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 425 | return templ_7745c5c3_CtxErr |
| 426 | } |
| 427 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 428 | if !templ_7745c5c3_IsBuffer { |
| 429 | defer func() { |
| 430 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 431 | if templ_7745c5c3_Err == nil { |
| 432 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 433 | } |
| 434 | }() |
| 435 | } |
| 436 | ctx = templ.InitializeContext(ctx) |
| 437 | templ_7745c5c3_Var20 := templ.GetChildren(ctx) |
| 438 | if templ_7745c5c3_Var20 == nil { |
| 439 | templ_7745c5c3_Var20 = templ.NopComponent |
| 440 | } |
| 441 | ctx = templ.ClearChildren(ctx) |
| 442 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 33, "<h1>Posts</h1>") |
| 443 | if templ_7745c5c3_Err != nil { |
| 444 | return templ_7745c5c3_Err |
| 445 | } |
| 446 | if len(v.Posts) == 0 { |
| 447 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "<p class=\"empty\">no posts yet</p>") |
| 448 | if templ_7745c5c3_Err != nil { |
| 449 | return templ_7745c5c3_Err |
| 450 | } |
| 451 | } |
| 452 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "<div class=\"post-list\">") |
| 453 | if templ_7745c5c3_Err != nil { |
| 454 | return templ_7745c5c3_Err |
| 455 | } |
| 456 | for _, p := range v.Posts { |
| 457 | templ_7745c5c3_Err = postItem(p, "post-item post-item-enhanced").Render(ctx, templ_7745c5c3_Buffer) |
| 458 | if templ_7745c5c3_Err != nil { |
| 459 | return templ_7745c5c3_Err |
| 460 | } |
| 461 | } |
| 462 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 36, "</div>") |
| 463 | if templ_7745c5c3_Err != nil { |
| 464 | return templ_7745c5c3_Err |
| 465 | } |
| 466 | return nil |
| 467 | }) |
| 468 | } |
| 469 | |
| 470 | func pageMeta(v pageView) templ.Component { |
| 471 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 472 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 473 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 474 | return templ_7745c5c3_CtxErr |
| 475 | } |
| 476 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 477 | if !templ_7745c5c3_IsBuffer { |
| 478 | defer func() { |
| 479 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 480 | if templ_7745c5c3_Err == nil { |
| 481 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 482 | } |
| 483 | }() |
| 484 | } |
| 485 | ctx = templ.InitializeContext(ctx) |
| 486 | templ_7745c5c3_Var21 := templ.GetChildren(ctx) |
| 487 | if templ_7745c5c3_Var21 == nil { |
| 488 | templ_7745c5c3_Var21 = templ.NopComponent |
| 489 | } |
| 490 | ctx = templ.ClearChildren(ctx) |
| 491 | templ_7745c5c3_Err = ogImage(v.siteContext).Render(ctx, templ_7745c5c3_Buffer) |
| 492 | if templ_7745c5c3_Err != nil { |
| 493 | return templ_7745c5c3_Err |
| 494 | } |
| 495 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 37, "<meta property=\"og:url\" content=\"") |
| 496 | if templ_7745c5c3_Err != nil { |
| 497 | return templ_7745c5c3_Err |
| 498 | } |
| 499 | var templ_7745c5c3_Var22 string |
| 500 | templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(v.SiteURL + "/" + v.Page.Slug) |
| 501 | if templ_7745c5c3_Err != nil { |
| 502 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 84, Col: 64} |
| 503 | } |
| 504 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) |
| 505 | if templ_7745c5c3_Err != nil { |
| 506 | return templ_7745c5c3_Err |
| 507 | } |
| 508 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "\">") |
| 509 | if templ_7745c5c3_Err != nil { |
| 510 | return templ_7745c5c3_Err |
| 511 | } |
| 512 | return nil |
| 513 | }) |
| 514 | } |
| 515 | |
| 516 | func pageBody(v pageView) templ.Component { |
| 517 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 518 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 519 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 520 | return templ_7745c5c3_CtxErr |
| 521 | } |
| 522 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 523 | if !templ_7745c5c3_IsBuffer { |
| 524 | defer func() { |
| 525 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 526 | if templ_7745c5c3_Err == nil { |
| 527 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 528 | } |
| 529 | }() |
| 530 | } |
| 531 | ctx = templ.InitializeContext(ctx) |
| 532 | templ_7745c5c3_Var23 := templ.GetChildren(ctx) |
| 533 | if templ_7745c5c3_Var23 == nil { |
| 534 | templ_7745c5c3_Var23 = templ.NopComponent |
| 535 | } |
| 536 | ctx = templ.ClearChildren(ctx) |
| 537 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "<div class=\"page-header\"><h1>") |
| 538 | if templ_7745c5c3_Err != nil { |
| 539 | return templ_7745c5c3_Err |
| 540 | } |
| 541 | var templ_7745c5c3_Var24 string |
| 542 | templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(v.Page.Title) |
| 543 | if templ_7745c5c3_Err != nil { |
| 544 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 89, Col: 20} |
| 545 | } |
| 546 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) |
| 547 | if templ_7745c5c3_Err != nil { |
| 548 | return templ_7745c5c3_Err |
| 549 | } |
| 550 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "</h1></div><article class=\"markdown-body\">") |
| 551 | if templ_7745c5c3_Err != nil { |
| 552 | return templ_7745c5c3_Err |
| 553 | } |
| 554 | templ_7745c5c3_Err = templ.Raw(string(v.RenderedContent)).Render(ctx, templ_7745c5c3_Buffer) |
| 555 | if templ_7745c5c3_Err != nil { |
| 556 | return templ_7745c5c3_Err |
| 557 | } |
| 558 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "</article>") |
| 559 | if templ_7745c5c3_Err != nil { |
| 560 | return templ_7745c5c3_Err |
| 561 | } |
| 562 | return nil |
| 563 | }) |
| 564 | } |
| 565 | |
| 566 | func postMeta(v postView) templ.Component { |
| 567 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 568 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 569 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 570 | return templ_7745c5c3_CtxErr |
| 571 | } |
| 572 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 573 | if !templ_7745c5c3_IsBuffer { |
| 574 | defer func() { |
| 575 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 576 | if templ_7745c5c3_Err == nil { |
| 577 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 578 | } |
| 579 | }() |
| 580 | } |
| 581 | ctx = templ.InitializeContext(ctx) |
| 582 | templ_7745c5c3_Var25 := templ.GetChildren(ctx) |
| 583 | if templ_7745c5c3_Var25 == nil { |
| 584 | templ_7745c5c3_Var25 = templ.NopComponent |
| 585 | } |
| 586 | ctx = templ.ClearChildren(ctx) |
| 587 | if v.Post.MetaDescription != nil { |
| 588 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "<meta name=\"description\" content=\"") |
| 589 | if templ_7745c5c3_Err != nil { |
| 590 | return templ_7745c5c3_Err |
| 591 | } |
| 592 | var templ_7745c5c3_Var26 string |
| 593 | templ_7745c5c3_Var26, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.MetaDescriptionStr()) |
| 594 | if templ_7745c5c3_Err != nil { |
| 595 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 98, Col: 64} |
| 596 | } |
| 597 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var26)) |
| 598 | if templ_7745c5c3_Err != nil { |
| 599 | return templ_7745c5c3_Err |
| 600 | } |
| 601 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 43, "\"><meta property=\"og:description\" content=\"") |
| 602 | if templ_7745c5c3_Err != nil { |
| 603 | return templ_7745c5c3_Err |
| 604 | } |
| 605 | var templ_7745c5c3_Var27 string |
| 606 | templ_7745c5c3_Var27, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.MetaDescriptionStr()) |
| 607 | if templ_7745c5c3_Err != nil { |
| 608 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 99, Col: 71} |
| 609 | } |
| 610 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var27)) |
| 611 | if templ_7745c5c3_Err != nil { |
| 612 | return templ_7745c5c3_Err |
| 613 | } |
| 614 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\">") |
| 615 | if templ_7745c5c3_Err != nil { |
| 616 | return templ_7745c5c3_Err |
| 617 | } |
| 618 | } |
| 619 | if v.Post.MetaImageStr() != "" { |
| 620 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 45, "<meta property=\"og:image\" content=\"") |
| 621 | if templ_7745c5c3_Err != nil { |
| 622 | return templ_7745c5c3_Err |
| 623 | } |
| 624 | var templ_7745c5c3_Var28 string |
| 625 | templ_7745c5c3_Var28, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.MetaImageStr()) |
| 626 | if templ_7745c5c3_Err != nil { |
| 627 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 102, Col: 59} |
| 628 | } |
| 629 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var28)) |
| 630 | if templ_7745c5c3_Err != nil { |
| 631 | return templ_7745c5c3_Err |
| 632 | } |
| 633 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 46, "\">") |
| 634 | if templ_7745c5c3_Err != nil { |
| 635 | return templ_7745c5c3_Err |
| 636 | } |
| 637 | } else { |
| 638 | templ_7745c5c3_Err = ogImage(v.siteContext).Render(ctx, templ_7745c5c3_Buffer) |
| 639 | if templ_7745c5c3_Err != nil { |
| 640 | return templ_7745c5c3_Err |
| 641 | } |
| 642 | } |
| 643 | if v.Post.CanonicalURL != nil { |
| 644 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 47, "<link rel=\"canonical\" href=\"") |
| 645 | if templ_7745c5c3_Err != nil { |
| 646 | return templ_7745c5c3_Err |
| 647 | } |
| 648 | var templ_7745c5c3_Var29 templ.SafeURL |
| 649 | templ_7745c5c3_Var29, templ_7745c5c3_Err = templ.JoinURLErrs(templ.URL(v.Post.CanonicalURLStr())) |
| 650 | if templ_7745c5c3_Err != nil { |
| 651 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 107, Col: 66} |
| 652 | } |
| 653 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var29)) |
| 654 | if templ_7745c5c3_Err != nil { |
| 655 | return templ_7745c5c3_Err |
| 656 | } |
| 657 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 48, "\">") |
| 658 | if templ_7745c5c3_Err != nil { |
| 659 | return templ_7745c5c3_Err |
| 660 | } |
| 661 | } |
| 662 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 49, "<meta property=\"og:title\" content=\"") |
| 663 | if templ_7745c5c3_Err != nil { |
| 664 | return templ_7745c5c3_Err |
| 665 | } |
| 666 | var templ_7745c5c3_Var30 string |
| 667 | templ_7745c5c3_Var30, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.DisplayTitle()) |
| 668 | if templ_7745c5c3_Err != nil { |
| 669 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 109, Col: 58} |
| 670 | } |
| 671 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var30)) |
| 672 | if templ_7745c5c3_Err != nil { |
| 673 | return templ_7745c5c3_Err |
| 674 | } |
| 675 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 50, "\"><meta property=\"og:type\" content=\"article\"><meta property=\"og:url\" content=\"") |
| 676 | if templ_7745c5c3_Err != nil { |
| 677 | return templ_7745c5c3_Err |
| 678 | } |
| 679 | var templ_7745c5c3_Var31 string |
| 680 | templ_7745c5c3_Var31, templ_7745c5c3_Err = templ.JoinStringErrs(v.SiteURL + "/posts/" + v.Post.Slug) |
| 681 | if templ_7745c5c3_Err != nil { |
| 682 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 111, Col: 70} |
| 683 | } |
| 684 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var31)) |
| 685 | if templ_7745c5c3_Err != nil { |
| 686 | return templ_7745c5c3_Err |
| 687 | } |
| 688 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 51, "\"><meta property=\"article:published_time\" content=\"") |
| 689 | if templ_7745c5c3_Err != nil { |
| 690 | return templ_7745c5c3_Err |
| 691 | } |
| 692 | var templ_7745c5c3_Var32 string |
| 693 | templ_7745c5c3_Var32, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.PublishedDateStr()) |
| 694 | if templ_7745c5c3_Err != nil { |
| 695 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 112, Col: 76} |
| 696 | } |
| 697 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var32)) |
| 698 | if templ_7745c5c3_Err != nil { |
| 699 | return templ_7745c5c3_Err |
| 700 | } |
| 701 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 52, "\">") |
| 702 | if templ_7745c5c3_Err != nil { |
| 703 | return templ_7745c5c3_Err |
| 704 | } |
| 705 | return nil |
| 706 | }) |
| 707 | } |
| 708 | |
| 709 | // The location icon is from Phosphor Icons: |
| 710 | // https://github.com/phosphor-icons/core/blob/main/LICENSE |
| 711 | func postBody(v postView) templ.Component { |
| 712 | return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) { |
| 713 | templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context |
| 714 | if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil { |
| 715 | return templ_7745c5c3_CtxErr |
| 716 | } |
| 717 | templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W) |
| 718 | if !templ_7745c5c3_IsBuffer { |
| 719 | defer func() { |
| 720 | templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer) |
| 721 | if templ_7745c5c3_Err == nil { |
| 722 | templ_7745c5c3_Err = templ_7745c5c3_BufErr |
| 723 | } |
| 724 | }() |
| 725 | } |
| 726 | ctx = templ.InitializeContext(ctx) |
| 727 | templ_7745c5c3_Var33 := templ.GetChildren(ctx) |
| 728 | if templ_7745c5c3_Var33 == nil { |
| 729 | templ_7745c5c3_Var33 = templ.NopComponent |
| 730 | } |
| 731 | ctx = templ.ClearChildren(ctx) |
| 732 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 53, "<div class=\"post-header\">") |
| 733 | if templ_7745c5c3_Err != nil { |
| 734 | return templ_7745c5c3_Err |
| 735 | } |
| 736 | if v.Post.HasTitle() { |
| 737 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 54, "<h1>") |
| 738 | if templ_7745c5c3_Err != nil { |
| 739 | return templ_7745c5c3_Err |
| 740 | } |
| 741 | var templ_7745c5c3_Var34 string |
| 742 | templ_7745c5c3_Var34, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.TitleStr()) |
| 743 | if templ_7745c5c3_Err != nil { |
| 744 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 120, Col: 26} |
| 745 | } |
| 746 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var34)) |
| 747 | if templ_7745c5c3_Err != nil { |
| 748 | return templ_7745c5c3_Err |
| 749 | } |
| 750 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 55, "</h1>") |
| 751 | if templ_7745c5c3_Err != nil { |
| 752 | return templ_7745c5c3_Err |
| 753 | } |
| 754 | } |
| 755 | if v.Post.MetaDescription != nil { |
| 756 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 56, "<p class=\"post-description\">") |
| 757 | if templ_7745c5c3_Err != nil { |
| 758 | return templ_7745c5c3_Err |
| 759 | } |
| 760 | var templ_7745c5c3_Var35 string |
| 761 | templ_7745c5c3_Var35, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.MetaDescriptionStr()) |
| 762 | if templ_7745c5c3_Err != nil { |
| 763 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 123, Col: 60} |
| 764 | } |
| 765 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var35)) |
| 766 | if templ_7745c5c3_Err != nil { |
| 767 | return templ_7745c5c3_Err |
| 768 | } |
| 769 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 57, "</p>") |
| 770 | if templ_7745c5c3_Err != nil { |
| 771 | return templ_7745c5c3_Err |
| 772 | } |
| 773 | } |
| 774 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 58, "<div class=\"post-weather\">") |
| 775 | if templ_7745c5c3_Err != nil { |
| 776 | return templ_7745c5c3_Err |
| 777 | } |
| 778 | if v.Post.PublishedDate != nil { |
| 779 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 59, "<span><time class=\"post-date\">") |
| 780 | if templ_7745c5c3_Err != nil { |
| 781 | return templ_7745c5c3_Err |
| 782 | } |
| 783 | var templ_7745c5c3_Var36 string |
| 784 | templ_7745c5c3_Var36, templ_7745c5c3_Err = templ.JoinStringErrs(v.Post.PublishedDateStr()) |
| 785 | if templ_7745c5c3_Err != nil { |
| 786 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 128, Col: 56} |
| 787 | } |
| 788 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var36)) |
| 789 | if templ_7745c5c3_Err != nil { |
| 790 | return templ_7745c5c3_Err |
| 791 | } |
| 792 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 60, "</time></span> <span>•</span> ") |
| 793 | if templ_7745c5c3_Err != nil { |
| 794 | return templ_7745c5c3_Err |
| 795 | } |
| 796 | } |
| 797 | if v.Post.Weather != nil { |
| 798 | templ_7745c5c3_Err = templ.Raw(string(v.Weather.Icon)).Render(ctx, templ_7745c5c3_Buffer) |
| 799 | if templ_7745c5c3_Err != nil { |
| 800 | return templ_7745c5c3_Err |
| 801 | } |
| 802 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 61, " <p class=\"weather-conditions\">") |
| 803 | if templ_7745c5c3_Err != nil { |
| 804 | return templ_7745c5c3_Err |
| 805 | } |
| 806 | var templ_7745c5c3_Var37 string |
| 807 | templ_7745c5c3_Var37, templ_7745c5c3_Err = templ.JoinStringErrs(v.Weather.Conditions) |
| 808 | if templ_7745c5c3_Err != nil { |
| 809 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 134, Col: 56} |
| 810 | } |
| 811 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var37)) |
| 812 | if templ_7745c5c3_Err != nil { |
| 813 | return templ_7745c5c3_Err |
| 814 | } |
| 815 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 62, "</p><p class=\"weather-temp\">") |
| 816 | if templ_7745c5c3_Err != nil { |
| 817 | return templ_7745c5c3_Err |
| 818 | } |
| 819 | var templ_7745c5c3_Var38 string |
| 820 | templ_7745c5c3_Var38, templ_7745c5c3_Err = templ.JoinStringErrs(v.Weather.Temperature) |
| 821 | if templ_7745c5c3_Err != nil { |
| 822 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 135, Col: 51} |
| 823 | } |
| 824 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var38)) |
| 825 | if templ_7745c5c3_Err != nil { |
| 826 | return templ_7745c5c3_Err |
| 827 | } |
| 828 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 63, "</p>•<div class=\"weather-location\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 256 256\"><path fill=\"currentColor\" d=\"M128 68a36 36 0 1 0 36 36a36 36 0 0 0-36-36m0 64a28 28 0 1 1 28-28a28 28 0 0 1-28 28m0-112a84.09 84.09 0 0 0-84 84c0 30.42 14.17 62.79 41 93.62a250 250 0 0 0 40.73 37.66a4 4 0 0 0 4.58 0A250 250 0 0 0 171 197.62c26.81-30.83 41-63.2 41-93.62a84.09 84.09 0 0 0-84-84m37.1 172.23A254.6 254.6 0 0 1 128 227a254.6 254.6 0 0 1-37.1-34.81C73.15 171.8 52 139.9 52 104a76 76 0 0 1 152 0c0 35.9-21.15 67.8-38.9 88.23\"></path></svg><p>") |
| 829 | if templ_7745c5c3_Err != nil { |
| 830 | return templ_7745c5c3_Err |
| 831 | } |
| 832 | var templ_7745c5c3_Var39 string |
| 833 | templ_7745c5c3_Var39, templ_7745c5c3_Err = templ.JoinStringErrs(v.Weather.Location) |
| 834 | if templ_7745c5c3_Err != nil { |
| 835 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 139, Col: 28} |
| 836 | } |
| 837 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var39)) |
| 838 | if templ_7745c5c3_Err != nil { |
| 839 | return templ_7745c5c3_Err |
| 840 | } |
| 841 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 64, "</p></div>") |
| 842 | if templ_7745c5c3_Err != nil { |
| 843 | return templ_7745c5c3_Err |
| 844 | } |
| 845 | } |
| 846 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 65, "</div>") |
| 847 | if templ_7745c5c3_Err != nil { |
| 848 | return templ_7745c5c3_Err |
| 849 | } |
| 850 | if len(v.Post.TagList()) > 0 { |
| 851 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 66, "<div class=\"post-tags\">") |
| 852 | if templ_7745c5c3_Err != nil { |
| 853 | return templ_7745c5c3_Err |
| 854 | } |
| 855 | for _, t := range v.Post.TagList() { |
| 856 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 67, "<span class=\"tag\">") |
| 857 | if templ_7745c5c3_Err != nil { |
| 858 | return templ_7745c5c3_Err |
| 859 | } |
| 860 | var templ_7745c5c3_Var40 string |
| 861 | templ_7745c5c3_Var40, templ_7745c5c3_Err = templ.JoinStringErrs(t) |
| 862 | if templ_7745c5c3_Err != nil { |
| 863 | return templ.Error{Err: templ_7745c5c3_Err, FileName: `public.templ`, Line: 146, Col: 26} |
| 864 | } |
| 865 | _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var40)) |
| 866 | if templ_7745c5c3_Err != nil { |
| 867 | return templ_7745c5c3_Err |
| 868 | } |
| 869 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 68, "</span>") |
| 870 | if templ_7745c5c3_Err != nil { |
| 871 | return templ_7745c5c3_Err |
| 872 | } |
| 873 | } |
| 874 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 69, "</div>") |
| 875 | if templ_7745c5c3_Err != nil { |
| 876 | return templ_7745c5c3_Err |
| 877 | } |
| 878 | } |
| 879 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 70, "</div><article class=\"markdown-body\">") |
| 880 | if templ_7745c5c3_Err != nil { |
| 881 | return templ_7745c5c3_Err |
| 882 | } |
| 883 | templ_7745c5c3_Err = templ.Raw(string(v.RenderedContent)).Render(ctx, templ_7745c5c3_Buffer) |
| 884 | if templ_7745c5c3_Err != nil { |
| 885 | return templ_7745c5c3_Err |
| 886 | } |
| 887 | templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 71, "</article>") |
| 888 | if templ_7745c5c3_Err != nil { |
| 889 | return templ_7745c5c3_Err |
| 890 | } |
| 891 | return nil |
| 892 | }) |
| 893 | } |
| 894 | |
| 895 | var _ = templruntime.GeneratedTemplate |