Просмотр исходного кода

Add permalinks

For now, these are only for posts with titles, but that will change.
Lucas Stadler лет назад: 9
Родитель
Сommit
11c6b1916f
1 измененных файлов с 19 добавлено и 1 удалено
  1. 19 1
      go/blog/blog.go

+ 19 - 1
go/blog/blog.go

@ -45,10 +45,22 @@ article header {
45 45
46 46
article h1 {
47 47
	margin: 0;
48
	margin-right: 1em;
48
}
49
50
article header .permalink {
51
	margin-left: 0.1em;
52
	text-decoration: none;
53
	color: #555;
54
55
	visibility: hidden;
56
}
57
58
article header:hover .permalink {
59
	visibility: visible;
49 60
}
50 61
51 62
article time {
63
	margin-left: 1em;
52 64
	color: #666;
53 65
}
54 66
@ -185,6 +197,7 @@ var shellTmpl = template.Must(template.New("shell").
185 197
<article id="{{ .Id }}" class="shell">
186 198
	<header>
187 199
		<h1><code class="language-shell">{{ .Title }}</code></h1>
200
		<a class="permalink" href="#{{ .Id }}">∞</a>
188 201
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
189 202
	</header>
190 203
	{{- if .Content }}
@ -199,6 +212,7 @@ var linkTmpl = template.Must(template.New("link").
199 212
<article id="{{ .Id }}" class="link">
200 213
	<header>
201 214
		<h1><a href="{{ .URL }}">{{ .Title }}</a></h1>
215
		<a class="permalink" href="#{{ .Id }}">∞</a>
202 216
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
203 217
	</header>
204 218
	{{- if .Content }}
@ -214,6 +228,7 @@ var imageTmpl = template.Must(template.New("image").
214 228
	{{- if .Title }}
215 229
	<header>
216 230
		<h1>{{ .Title }}</h1>
231
		<a class="permalink" href="#{{ .Id }}">∞</a>
217 232
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
218 233
	</header>
219 234
	{{- end }}
@ -231,6 +246,7 @@ var songTmpl = template.Must(template.New("song").
231 246
	{{- if .Title }}
232 247
	<header>
233 248
		<h1>{{ .Title }}</h1>
249
		<a class="permalink" href="#{{ .Id }}">∞</a>
234 250
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
235 251
	</header>
236 252
	{{- end }}
@ -249,6 +265,7 @@ var textTmpl = template.Must(template.New("text").
249 265
<article id="{{ .Id }}" class="text">
250 266
	<header>
251 267
		<h1>{{ .Title }}</h1>
268
		<a class="permalink" href="#{{ .Id }}">∞</a>
252 269
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
253 270
	</header>
254 271
	{{- if .Content }}
@ -264,6 +281,7 @@ var videoTmpl = template.Must(template.New("video").
264 281
	{{- if .Title }}
265 282
	<header>
266 283
		<h1>{{ .Title }}</h1>
284
		<a class="permalink" href="#{{ .Id }}">∞</a>
267 285
		{{- if .Date }}<time>{{ .Date }}</time>{{ end -}}
268 286
	</header>
269 287
	{{- end }}