aboutsummaryrefslogtreecommitdiff
path: root/site.tmpl
blob: c7459975356a055d3d2581aa1968ce80da5233e9 (plain)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{{ define "header" }}
<!doctype html>
<html lang="en">

  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="theme-color" content="#ffffff">
    <meta name="google-site-verification" content="{{ html .Site.Other.Google_verification }}">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <link rel="preconnect" href="https://www.google-analytics.com">

    <link rel="alternate" type="application/atom+xml" title="{{ html .Site.Other.Title }} feed" href="{{ .Rel "feed.atom" }}">
    <link rel="stylesheet" type="text/css" href="{{ .Rel "static/style.css" }}?v={{ .ModTime.Format "20060102150405" }}">
    <link rel="icon" type="image/png" href="{{ .Rel "static/avatar-64x64.png" }}?v={{ .ModTime.Format "20060102150405" }}">

    <title>{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Other.Title }}</title>
    <meta name="author" content="{{ html .Site.Other.Author }}">
    <meta name="description" content="{{ if .Other.Description  }}{{ .Other.Description }}{{ else }}{{ html .Site.Other.Description }}{{ end }}">

    <meta property="og:title" content="{{ if .Title }}{{ .Title }} - {{ end }}{{ .Site.Other.Title }}">
    <meta property="og:description" content="{{ if .Other.Description  }}{{ .Other.Description }}{{ else }}{{ html .Site.Other.Description }}{{ end }}">
    <meta property="og:url" content="{{ .Site.Other.Url }}/{{ .Url }}">

    <meta name="twitter:card" content="summary">
    <meta name="twitter:site" content="{{ html .Site.Other.Twitter_handle }}">
  </head>

  <body>
    <main>
      {{ end }}
      {{ define "footer" }}
    </main>
    {{ template "ga" . }}
  </body>

</html>
{{ end }}

{{ define "navigation" }}
<nav>
  <a href="/">{{ html .Site.Other.Author }}</a>
  <a href="/curriculum-vitae.html">CV</a>
  <a href="https://twitter.com/mitjafelicijan" target="_blank" rel="noopener nofollow">Twitter</a>
  <a href="https://github.com/mitjafelicijan" target="_blank" rel="noopener nofollow">Github</a>
</nav>
{{ end }}

{{ define "author" }}
<span>by {{ html .Site.Other.Author }}</span>
{{ end }}

{{define "date"}}
<time datetime="{{ .Format "2006-01-02T15:04:05Z07:00" }}">
  {{ .Format "2006, January 02" }}
</time>
{{end}}

{{define "modified"}}
<p class="modified">Modified on {{ .ModTime.Format "2006-01-02T15:04:05" }}</p>
{{end}}

{{ define "page" }}
{{ template "header" . }}
{{ template "navigation" . }}
{{ .Content }}
{{ template "prism" . }}
{{ template "mathjax" . }}
{{ template "footer" . }}
{{ end }}

{{ define "post" }}
<article>
  <header>
    <h1>{{ .Title }}</h1>
    {{ if eq .Other.Type "post" }}
    <div class="info">
      {{ template "date" .Date }}
      {{ template "author" . }}
    </div>
    {{ end }}
  </header>
  <section>
    {{ .Content }}
  </section>
</article>

{{ if eq .Other.Type "post" }}
{{ template "comments" . }}
{{ end }}

{{ template "modified" . }}
{{ end }}

{{ define "mathjax" }}
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
      TeX: { equationNumbers: { autoNumber: "AMS" } },
      tex2jax: {
        inlineMath: [ [ '$', '$' ], [ '\\(', '\\)' ] ],
        displayMath: [ ['$$', '$$'] ],
        processEscapes: true
      }});
  </script>
<script src="//cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML" async="async"></script>
{{ end }}

{{ define "ga" }}
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-12769079-10"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag() {
    dataLayer.push(arguments);
  }
  gtag('js', new Date());
  gtag('config', 'UA-12769079-10');
</script>
{{ end }}

{{ define "prism" }}
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"></script>
{{ end }}

{{ define "comments" }}
<div class="comments">
  <h3>Comments</h3>
  <div class="form">
    <div><input id="name" placeholder="Your name" maxlength="20"></div>
    <div><textarea id="comment" placeholder="Your comment" maxlength="500"></textarea></div>
    <div><button id="submit">Post a comment</button></div>
  </div>
  <ul></ul>
</div>

<script src="https://www.gstatic.com/firebasejs/7.2.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.2.1/firebase-database.js"></script>
<script src="{{ .Rel "static/comments.js" }}?v={{ .ModTime.Format "20060102150405" }}" async></script>
{{ end }}