~alanorth/hugo-theme-bootstrap4-blog

ref: c1b3e978b7d8c6ec89d804d00e8bb306f45adbb4 hugo-theme-bootstrap4-blog/layouts/_default/single.html -rw-r--r-- 2.8 KiB
c1b3e978 — TommySprat Remove escape characters in formatted date 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{{ define "title" }}{{ .Title | markdownify }} | {{ .Site.Title }}{{ end }}

{{ define "schema-dot-org" }}
<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "BlogPosting",
  {{- /* Google recommends the headline be no more than 110 characters */}}
  "headline": "{{ substr .Title 0 110 }}",
  {{- with .Params.images -}}{{ range first 1 . }}
  "image": {
    "@type": "ImageObject",
    "url": "{{ . | absURL }}"
    {{- /* Don't try to get imageConfig if image param is not local */ -}}
    {{- if not (or (hasPrefix . "http://") (hasPrefix . "https://")) -}}
    {{- with (imageConfig (printf "/static/%s" .)) -}}
    ,
    "height": "{{ .Height }}",
    "width": "{{ .Width }}"
    {{- end -}}
    {{ end }}
  },
  {{- end -}}{{ end }}
  "url": "{{ printf "%s" .Permalink }}",
  "wordCount": "{{ .WordCount }}",
  {{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
  {{- if not .PublishDate.IsZero }}
  "datePublished": {{ .PublishDate.Format $ISO8601 }},
  {{- else }}
  "datePublished": {{ .Date.Format $ISO8601 }},
  {{- end }}
  {{- if not .Lastmod.IsZero }}
  "dateModified": {{ .Lastmod.Format $ISO8601 }},
  {{- end }}
  {{- with .Site.Social.GooglePlus }}
  "publisher": "{{ printf "%s" . }}",
  {{- end }}
  "author": {
    "@type": "Person",
    "name": "{{ .Params.author | default .Site.Params.author }}"
  }
  {{- if or (.Params.keywords) (or (.Params.categories) (.Params.tags)) -}}
  ,
  "keywords": "{{ delimit (union .Params.keywords (union .Params.categories .Params.tags)) ", " }}"
  {{- end }}

  {{- with .Params.description -}}
  ,
  "description": "{{ . }}"
  {{- end }}
}
</script>

{{ end }}

{{ define "main" }}
{{ $dateFormat := default "Mon Jan 2, 2006" (index .Site.Params "date_format") }}

<article class="blog-post">
  <header>
    <h2 class="blog-post-title" dir="auto"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
    <p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> {{ i18n "authoredBy" }} {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} {{ i18n "postedIn" }} {{ partial "meta-terms.html" . }}{{ end }}</p>
  </header>
  {{ .Content }}

  {{ if .IsTranslated }}
  <h4>{{ i18n "translations" }}</h4>
  <ul>
    {{ range .Translations }}
    <li>
      <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }}{{ end }}</a>
    </li>
    {{ end }}
  </ul>
  {{ end }}

  {{ if or (ne ($.Param "sharingicons") false) (.Site.DisqusShortname) }}
  <hr>
  <footer>

  {{ if (ne ($.Param "sharingicons") false) }}
  {{ partial "sharing-icons.html" . }}
  {{ end }}

  {{ if and (.Site.DisqusShortname) (ne .Params.comments false) }}
  {{ template "_internal/disqus.html" . }}
  {{ end }}
  </footer>
  {{ end }}

</article> <!-- /.blog-post -->

{{ end }}

{{- /* vim: set ts=2 sw=2 et: */}}