2021-12-29 21:08:09 +00:00
|
|
|
{% import (
|
|
|
|
"golang.org/x/text/language"
|
|
|
|
"golang.org/x/text/message"
|
|
|
|
|
2022-01-04 17:31:33 +00:00
|
|
|
"source.toby3d.me/website/indieauth/internal/domain"
|
2021-12-29 21:08:09 +00:00
|
|
|
) %}
|
|
|
|
|
2021-07-21 23:04:00 +00:00
|
|
|
{% interface Page {
|
2021-12-29 21:08:09 +00:00
|
|
|
Body()
|
|
|
|
Head()
|
2021-07-21 23:04:00 +00:00
|
|
|
Lang()
|
2021-12-29 21:08:09 +00:00
|
|
|
Title()
|
2022-01-04 17:31:33 +00:00
|
|
|
T(format string, args ...interface{})
|
2021-07-21 23:04:00 +00:00
|
|
|
} %}
|
|
|
|
|
2022-01-04 17:31:33 +00:00
|
|
|
{% code type BaseOf struct {
|
|
|
|
Config *domain.Config
|
|
|
|
Language language.Tag
|
|
|
|
Printer *message.Printer
|
|
|
|
} %}
|
2021-07-21 23:04:00 +00:00
|
|
|
|
2021-12-29 21:08:09 +00:00
|
|
|
{% stripspace %}
|
|
|
|
{% func (p *BaseOf) Lang() %}
|
|
|
|
{% if p.Language != language.Und %}
|
|
|
|
{%s p.Language.String() %}
|
|
|
|
{% else %}
|
|
|
|
en
|
|
|
|
{% endif %}
|
|
|
|
{% endfunc %}
|
|
|
|
{% endstripspace %}
|
|
|
|
|
|
|
|
{% collapsespace %}
|
|
|
|
{% func (p *BaseOf) Title() %}
|
|
|
|
{%s p.Config.Name %}
|
|
|
|
{% endfunc %}
|
|
|
|
|
|
|
|
{% func (p *BaseOf) Head() %}
|
|
|
|
{% comment %}https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs{% endcomment %}
|
|
|
|
<link
|
|
|
|
rel="icon"
|
|
|
|
href="{%s p.Config.Server.StaticURLPrefix %}/favicon.ico"
|
|
|
|
sizes="any">
|
2021-07-21 23:04:00 +00:00
|
|
|
|
2021-12-29 21:08:09 +00:00
|
|
|
<link
|
|
|
|
rel="icon"
|
|
|
|
href="{%s p.Config.Server.StaticURLPrefix %}/icon.svg"
|
|
|
|
type="image/svg+xml">
|
2021-07-21 23:04:00 +00:00
|
|
|
|
2021-12-29 21:08:09 +00:00
|
|
|
<link
|
|
|
|
rel="apple-touch-icon"
|
|
|
|
href="{%s p.Config.Server.StaticURLPrefix %}/apple-touch-icon.png">
|
|
|
|
|
|
|
|
<link
|
|
|
|
rel="manifest"
|
|
|
|
href="{%s p.Config.Server.StaticURLPrefix %}/manifest.webmanifest">
|
|
|
|
{% endfunc %}
|
2021-07-21 23:04:00 +00:00
|
|
|
|
|
|
|
{% func (p *BaseOf) Body() %}{% endfunc %}
|
|
|
|
|
2021-12-29 21:08:09 +00:00
|
|
|
{% func Template(p Page) %}
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html
|
|
|
|
class="page"
|
|
|
|
lang="{%= p.Lang() %}">
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta
|
|
|
|
name="viewport"
|
|
|
|
content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
{%= p.Head() %}
|
2022-01-04 17:31:33 +00:00
|
|
|
|
2021-12-29 21:08:09 +00:00
|
|
|
<title>{%= p.Title() %}</title>
|
|
|
|
</head>
|
|
|
|
<body class="page__body body">
|
|
|
|
{%= p.Body() %}
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
{% endfunc %}
|
|
|
|
|
2022-01-04 17:31:33 +00:00
|
|
|
{% func (p *BaseOf) T(format string, args ...interface{}) %}
|
2022-02-02 17:52:52 +00:00
|
|
|
{%s p.Printer.Sprintf(format, args...) %}
|
2021-12-29 21:08:09 +00:00
|
|
|
{% endfunc %}
|
|
|
|
{% endcollapsespace %}
|