2024-06-13 04:49:55 +04:00
|
|
|
|
package web
|
|
|
|
|
|
2024-06-19 03:08:50 +04:00
|
|
|
|
import "strings"
|
2024-07-04 03:56:57 +04:00
|
|
|
|
import "net/http"
|
2024-06-13 04:49:55 +04:00
|
|
|
|
|
2024-09-14 18:36:08 +04:00
|
|
|
|
import "github.com/invopop/ctxi18n/i18n"
|
|
|
|
|
|
2024-07-02 04:12:50 +04:00
|
|
|
|
import "git.arav.su/Arav/dwelling-home/internal/version"
|
2024-07-04 03:56:57 +04:00
|
|
|
|
import "git.arav.su/Arav/dwelling-home/pkg/util"
|
2024-07-02 04:12:50 +04:00
|
|
|
|
|
2024-07-04 03:56:57 +04:00
|
|
|
|
templ base(title, description, keywords, canonical string, r *http.Request, head templ.Component) {
|
2024-06-19 01:08:05 +04:00
|
|
|
|
<!DOCTYPE html>
|
2024-09-17 03:13:30 +04:00
|
|
|
|
<html lang={ i18n.GetLocale(ctx).Code().String() }>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
<head>
|
2024-06-19 03:08:50 +04:00
|
|
|
|
if title != "" && title != "Home" {
|
2024-06-19 01:08:05 +04:00
|
|
|
|
<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 != "" {
|
2024-07-04 03:56:57 +04:00
|
|
|
|
<link rel="canonical" href={ util.GetServiceByHost(r.Host, util.ServiceHome) + canonical }/>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
}
|
|
|
|
|
if head != nil {
|
|
|
|
|
@head
|
|
|
|
|
}
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
2024-06-19 03:08:50 +04:00
|
|
|
|
<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>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
</svg>
|
2024-09-14 18:36:08 +04:00
|
|
|
|
{{ 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")} }}
|
2024-06-30 03:00:03 +04:00
|
|
|
|
{{ mainNavLinks := []templ.SafeURL{"/stuff", "/mindflow", "/about", "/guestbook"} }}
|
|
|
|
|
<nav>
|
|
|
|
|
<ul>
|
|
|
|
|
if title != "" {
|
2024-09-14 18:36:08 +04:00
|
|
|
|
<li><a href="/">{ i18n.T(ctx, "base.section.home") }</a></li>
|
2024-06-30 03:00:03 +04:00
|
|
|
|
}
|
|
|
|
|
for i, s := range mainNavSections {
|
|
|
|
|
if strings.HasSuffix(title, s) {
|
|
|
|
|
{{ continue }}
|
|
|
|
|
}
|
|
|
|
|
<li><a href={ mainNavLinks[i] }>{ s }</a></li>
|
|
|
|
|
}
|
|
|
|
|
</ul>
|
|
|
|
|
if title != "" {
|
|
|
|
|
<h1>
|
2024-09-14 18:36:08 +04:00
|
|
|
|
if strings.HasSuffix(title, "- " + i18n.T(ctx, "base.section.stuff")) {
|
|
|
|
|
{ i18n.T(ctx, "base.section.stuff") }
|
2024-06-30 03:00:03 +04:00
|
|
|
|
} else {
|
|
|
|
|
{ title }
|
|
|
|
|
}
|
|
|
|
|
</h1>
|
|
|
|
|
}
|
|
|
|
|
</nav>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
</header>
|
2024-06-25 22:42:43 +04:00
|
|
|
|
<main>
|
|
|
|
|
{ children... }
|
|
|
|
|
</main>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
<footer>
|
2024-09-14 18:36:08 +04:00
|
|
|
|
<a href="/rss.xml" title={ i18n.T(ctx, "base.rss-feed-title") }>{ i18n.T(ctx, "base.rss-feed") }</a>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
<br/>
|
2024-09-15 00:29:52 +04:00
|
|
|
|
<a href="?lang=ru">рус</a>
|
|
|
|
|
<a href="?lang=en">eng</a>
|
|
|
|
|
<br/>
|
2024-09-14 18:36:08 +04:00
|
|
|
|
{ version.GetVersion() } © 2017—2024 { i18n.T(ctx, "base.copy-author") } <<a href="mailto:me@arav.su">me@arav.su</a>> <a href="/privacy">{ i18n.T(ctx, "base.privacy-statements-link") }</a>
|
2024-06-19 01:08:05 +04:00
|
|
|
|
</footer>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
2024-06-30 03:00:03 +04:00
|
|
|
|
}
|