apps/posts/templates/post.html 2.5 K raw
1
{{define "post.html"}}{{template "base.html" .}}{{end}}
2
{{define "title"}}{{.Post.DisplayTitle}} — {{.BlogTitle}}{{end}}
3
{{define "meta"}}
4
  {{if .Post.MetaDescription}}
5
    <meta name="description" content="{{.Post.MetaDescriptionStr}}">
6
    <meta property="og:description" content="{{.Post.MetaDescriptionStr}}">
7
  {{end}}
8
  {{if and .Post.MetaImage .Post.MetaImageStr}}
9
    <meta property="og:image" content="{{.Post.MetaImageStr}}">
10
  {{else if .OGImageURL}}
11
    <meta property="og:image" content="{{.OGImageURL}}">
12
  {{else}}
13
    <meta property="og:image" content="{{.SiteURL}}/static/og.png">
14
  {{end}}
15
  {{if .Post.CanonicalURL}}
16
    <link rel="canonical" href="{{.Post.CanonicalURLStr}}">
17
  {{end}}
18
  <meta property="og:title" content="{{.Post.DisplayTitle}}">
19
  <meta property="og:type" content="article">
20
  <meta property="og:url" content="{{.SiteURL}}/posts/{{.Post.Slug}}">
21
  <meta property="article:published_time" content="{{.Post.PublishedDateStr}}">
22
{{end}}
23
{{define "content"}}
24
  <div class="post-header">
25
    {{if .Post.HasTitle}}
26
      <h1>{{.Post.TitleStr}}</h1>
27
    {{end}}
28
    {{if .Post.MetaDescription}}
29
      <p class="post-description">{{.Post.MetaDescriptionStr}}</p>
30
    {{end}}
31
    <div class="post-weather">
32
    {{if .Post.PublishedDate}}
33
      <span>
34
      <time class="post-date">{{.Post.PublishedDateStr}}</time>
35
      </span>
36
      <span>•</span>
37
    {{end}}
38
    {{if .Post.Weather}}
39
      {{.Weather.Icon}}
40
      <p class="weather-conditions">{{.Weather.Conditions}}</p>
41
      <p class="weather-temp">{{.Weather.Temperature}}</p>
42
43
      <div class="weather-location">
44
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE --><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"/></svg>
45
      <p>{{.Weather.Location}}</p>
46
      </div>
47
    {{end}}
48
    </div>
49
    {{if .Post.Tags}}
50
      <div class="post-tags">
51
        {{range .Post.TagList}}
52
          <span class="tag">{{.}}</span>
53
        {{end}}
54
      </div>
55
    {{end}}
56
  </div>
57
  <article class="markdown-body">
58
    {{.RenderedContent}}
59
  </article>
60
{{end}}