1
0
dwelling-home/web/base.templ

80 lines
2.8 KiB
Plaintext
Raw Normal View History

package web
import "strings"
import "net/http"
import "github.com/invopop/ctxi18n/i18n"
import "git.arav.su/Arav/dwelling-home/internal/version"
import "git.arav.su/Arav/dwelling-home/pkg/util"
templ base(title, description, keywords, canonical string, r *http.Request, head templ.Component) {
<!DOCTYPE html>
<html lang={ i18n.GetLocale(ctx).Code().String() }>
<head>
if title != "" && title != "Home" {
<title>{ title } - Arav's dwelling</title>
} else {
<title>Arav's dwelling</title>
}
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="theme-color" content="#cd2682"/>
<meta name="description" content={ description }/>
<meta name="keywords" content={ keywords }/>
<link rel="icon" href="/assets/img/favicon.svg" sizes="any" type="image/svg+xml"/>
<link rel="stylesheet" href="/assets/css/main.css"/>
<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Arav's dwelling"/>
if canonical != "" {
<link rel="canonical" href={ util.GetServiceByHost(r.Host, util.ServiceHome) + canonical }/>
}
if head != nil {
@head
}
</head>
<body>
<header class="main">
<svg viewBox="0 -36 360 66">
<text y="7" textLength="360" lengthAdjust="spacingAndGlyphs">Arav's dwelling</text>
<text y="25" textLength="360" lengthAdjust="spacingAndGlyphs">Welcome to my sacred place, wanderer</text>
</svg>
{{ mainNavSections := []string{i18n.T(ctx, "base.section.stuff"), i18n.T(ctx, "base.section.mindflow"), i18n.T(ctx, "base.section.about"), i18n.T(ctx, "base.section.guestbook")} }}
{{ mainNavLinks := []templ.SafeURL{"/stuff", "/mindflow", "/about", "/guestbook"} }}
<nav>
<ul>
if title != "" {
<li><a href="/">{ i18n.T(ctx, "base.section.home") }</a></li>
}
for i, s := range mainNavSections {
if strings.HasSuffix(title, s) {
{{ continue }}
}
<li><a href={ mainNavLinks[i] }>{ s }</a></li>
}
</ul>
if title != "" {
<h1>
if strings.HasSuffix(title, "- " + i18n.T(ctx, "base.section.stuff")) {
{ i18n.T(ctx, "base.section.stuff") }
} else {
{ title }
}
</h1>
}
</nav>
</header>
<main>
{ children... }
</main>
<footer>
<a href="/rss.xml" title={ i18n.T(ctx, "base.rss-feed-title") }>{ i18n.T(ctx, "base.rss-feed") }</a>
<br/>
2024-09-15 00:29:52 +04:00
<a href="?lang=ru">рус</a>
<a href="?lang=en">eng</a>
<br/>
{ version.GetVersion() } &copy; 2017&mdash;2024 { i18n.T(ctx, "base.copy-author") } &lt;<a href="mailto:me@arav.su">me@arav.su</a>&gt; <a href="/privacy">{ i18n.T(ctx, "base.privacy-statements-link") }</a>
</footer>
</body>
</html>
}