aboutsummaryrefslogtreecommitdiff
path: root/template_index_html.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-24 21:49:40 +0700
committerShulhan <ms@kilabit.info>2022-07-24 21:49:40 +0700
commitb1ac34fb775bcf0d15ac61de7dcbb6c30d03f46d (patch)
tree6e9479db8f1ce1d0f3b503b2e246a4fceb11a49f /template_index_html.go
parent73584411dcb3563e373e5b4d6c6a40cc0656bfc6 (diff)
downloadciigo-b1ac34fb775bcf0d15ac61de7dcbb6c30d03f46d.tar.xz
all: generate HTML meta data and replace the top header title
The following metadata are rendered based on the same asciidoc attributes: author, description, generator, and keywords. This changes also replace the topbar title with the document title, cleanup the HTML header syntax by replacing "/>" with ">", trim leading and trailing spaces on Body and embedded CSS.
Diffstat (limited to 'template_index_html.go')
-rw-r--r--template_index_html.go22
1 files changed, 10 insertions, 12 deletions
diff --git a/template_index_html.go b/template_index_html.go
index f6d617c..5dad59b 100644
--- a/template_index_html.go
+++ b/template_index_html.go
@@ -6,25 +6,25 @@ package ciigo
const templateIndexHTML = `<!DOCTYPE html>
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="theme-color" content="#375EAB" />
-
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <meta name="theme-color" content="#375EAB">
+ {{range $k, $v := .Metadata -}}
+ <meta name="{{$k}}" content="{{$v}}">
+ {{end -}}
<title>{{.Title}}</title>
-
<style>
- {{.EmbeddedCSS}}
+ {{- .EmbeddedCSS -}}
</style>
-
{{- range .Styles}}
- <link rel="stylesheet" href="{{.}}" />
+ <link rel="stylesheet" href="{{.}}">
{{- end}}
</head>
<body>
<div class="topbar">
<div class="container">
<div class="top-heading">
- <a href="/">ciigo</a>
+ <a href="/">{{.Title}}</a>
</div>
<div class="menu">
<form class="item" action="/_internal/search">
@@ -36,11 +36,9 @@ const templateIndexHTML = `<!DOCTYPE html>
<div class="page">
<div class="container">
- {{.Body}}
+ {{- .Body -}}
</div>
- <!-- .container -->
</div>
- <!-- .page -->
<div class="footer">
Powered by <a