2020-08-30 14:26:50 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>HTML Template Example</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
2020-08-30 16:18:04 +02:00
|
|
|
<h2>Name: {{.Name}}</h2>
|
|
|
|
<h3>Age: {{.Age}}</h3>
|
2020-08-30 14:26:50 +02:00
|
|
|
|
|
|
|
<h4>Slice</h4>
|
|
|
|
{{range $idx, $item := .Items}}
|
|
|
|
{{ $idx }} - {{ $item }} <br/>
|
|
|
|
{{end}}
|
2020-08-30 16:18:04 +02:00
|
|
|
|
2020-08-30 14:26:50 +02:00
|
|
|
<h4>Map</h4>
|
|
|
|
{{range $key, $value := .Map}}
|
|
|
|
{{ $key }} - {{ $value }} <br/>
|
|
|
|
{{end}}
|
|
|
|
|
2020-08-30 16:18:04 +02:00
|
|
|
<h4>Nested</h4>
|
|
|
|
|
|
|
|
<strong>Title:</strong>{{ .Nested.Title}}
|
|
|
|
|
2020-08-30 14:26:50 +02:00
|
|
|
<hr/>
|
|
|
|
|
2022-03-10 20:48:05 +01:00
|
|
|
<strong>Read more at: <a href="https://pkg.go.dev/html/template" target="_new">
|
|
|
|
https://pkg.go.dev/html/template</a>
|
2020-08-30 14:26:50 +02:00
|
|
|
</strong>
|
|
|
|
</body>
|
|
|
|
</html>
|