| -rw-r--r-- | config/config.go | 6 | ||||
| -rw-r--r-- | config/config.prod.yaml | 8 | ||||
| -rw-r--r-- | internal/router/handlers/lang-blog-title.go | 6 | ||||
| -rw-r--r-- | internal/router/handlers/root.go | 7 | ||||
| -rw-r--r-- | internal/router/router.go | 2 | ||||
| -rw-r--r-- | static/input.css | 8 | ||||
| -rw-r--r-- | views/layouts/general-page.html | 37 | ||||
| -rw-r--r-- | views/partials/general-page-header.html | 2 |
8 files changed, 43 insertions, 33 deletions
diff --git a/config/config.go b/config/config.go index 9185e6a..8ab1bfc 100644 --- a/config/config.go +++ b/config/config.go @@ -20,7 +20,7 @@ type Config struct { Auth AuthConfig `json:"Auth" yaml:"auth" validate:"required"` Mail MailConfig `json:"Mail" yaml:"mail" validate:"required"` CanonicalEndpoint string `json:"CanonicalEndpoint" yaml:"canonicalEndpoint" validate:"required"` - Meta []MetaConfig `json:"Meta" yaml:"meta"` + Meta MetaConfig `json:"Meta" yaml:"meta"` PhotoStorage PhotoStorageConfig `json:"PhotoStorage" yaml:"photoStorage"` StaticStorage StaticStorageConfig `json:"StaticStorage" yaml:"staticStorage" validate:"required"` AllowOrigins []string `json:"AllowOrigins" yaml:"allowOrigins"` @@ -237,8 +237,8 @@ type TriggerConfig struct { } type MetaConfig struct { - Name string `json:"Name" yaml:"name"` - Value string `json:"Value" yaml:"value"` + GoogleSiteVerification string `json:"GoogleSiteVerification" yaml:"googleSiteVerification"` + YandexVerification string `json:"YandexVerification" yaml:"yandexVerification"` } type PhotoStorageConfig struct { diff --git a/config/config.prod.yaml b/config/config.prod.yaml index 6ec00d8..ce0941d 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -55,12 +55,8 @@ mail: onNewPost: "0/5 * * * *" canonicalEndpoint: "https://${FQDN}" meta: - - name: google-site-verification - value: "${GOOGLE_SITE_VERIFICATION}" - - name: yandex-verification - value: "${YANDEX_VERIFICATION}" - - name: msvalidate.01 - value: "${BING_VERIFICATION}" + googleSiteVerification: "${GOOGLE_SITE_VERIFICATION}" + yandexVerification: "${YANDEX_VERIFICATION}" photoStorage: full: baseUrl: https://cdn.saya.uz/photos/jpeg-full/%s diff --git a/internal/router/handlers/lang-blog-title.go b/internal/router/handlers/lang-blog-title.go index 76dc335..5a1155d 100644 --- a/internal/router/handlers/lang-blog-title.go +++ b/internal/router/handlers/lang-blog-title.go @@ -156,13 +156,7 @@ func (r *BlogPageHandler) RenderHeader(c *fiber.Ctx, supplements *router.Supplem return fiber.StatusNotFound, fmt.Errorf("could not read '%s' for metadata: %w", path, err) } - pageTitle := metadata.Title - if metadata.Medley != "" { - pageTitle += " // " + l10n.T.GetPath(lang, "Medleys", metadata.Medley).(string) - } - templateMap["Title"] = metadata.Title - templateMap["PageTitle"] = pageTitle return fiber.StatusOK, nil } diff --git a/internal/router/handlers/root.go b/internal/router/handlers/root.go index 4fc4e31..6a011e4 100644 --- a/internal/router/handlers/root.go +++ b/internal/router/handlers/root.go @@ -47,8 +47,11 @@ func (r *RootHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lan {Property: "og:url", Content: fmt.Sprint(templateMap["CanonicalEndpoint"]) + "/"}, {Property: "og:type", Content: "website"}, } - for _, field := range supplements.Meta { - meta = append(meta, router.MetaField{Name: field.Name, Content: field.Value}) + if supplements.Meta.GoogleSiteVerification != "" { + meta = append(meta, router.MetaField{Name: "google-site-verification", Content: supplements.Meta.GoogleSiteVerification}) + } + if supplements.Meta.YandexVerification != "" { + meta = append(meta, router.MetaField{Name: "yandex-verification", Content: supplements.Meta.YandexVerification}) } return meta, nil } diff --git a/internal/router/router.go b/internal/router/router.go index a11a934..c8b5686 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -102,7 +102,7 @@ type Supplements struct { BlogTrigger *blogtrigger.BlogTriggerScheduler TemplateManager *templatemanager.TemplateManager MarkdownRenderer goldmark.Markdown - Meta []config.MetaConfig + Meta config.MetaConfig PhotoStorage config.PhotoStorageConfig StaticStorage config.StaticStorageConfig } diff --git a/static/input.css b/static/input.css index e0c5c81..0dfb137 100644 --- a/static/input.css +++ b/static/input.css @@ -87,10 +87,6 @@ body { scrollbar-color: var(--color-background-light) var(--color-main-soft); } -body.glightbox-open { - height: 100dvh; -} - @media screen and (min-width: 900px) and (min-height: 900px) { html { font-size: clamp(16px, min(1dvw, 1dvh) + 7px, 20px); @@ -904,8 +900,8 @@ form.crossable.htmx-request input { } .ram-frame { - width: 8rem; - height: 8rem; + width: 20vmin; + height: 20vmin; user-select: none; -webkit-user-select: none; } diff --git a/views/layouts/general-page.html b/views/layouts/general-page.html index 06ef625..78c7f0c 100644 --- a/views/layouts/general-page.html +++ b/views/layouts/general-page.html @@ -213,8 +213,18 @@ var seed = cyrb128("{{ .Title }}"); var rand = sfc32(seed[0], seed[1], seed[2], seed[3]); - function calculateRem(remNum) { - return remNum * parseFloat(getComputedStyle(document.documentElement).fontSize); + function calculateVmin(percent) { + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; + + const smallerDimension = Math.min( + viewportWidth, + viewportHeight, + ); + + const vminValue = (smallerDimension / 100) * percent; + + return vminValue; } const _probe = document.createElement('div'); @@ -309,7 +319,7 @@ theme = document.body.getAttribute("data-theme"); } - rem = calculateRem(1); + vmin = calculateVmin(1); var clWidth = document.documentElement.clientWidth; var clHeight = document.documentElement.clientHeight; @@ -328,11 +338,11 @@ "z-0", "absolute", ); + const x = Math.floor(rand() * clWidth); + const y = Math.floor(rand() * clHeight * 0.8); const rot = rand() * 90; const animDuration = rand() * 10 + 3; const sz = Math.floor(rand() * 8) + 12; - const x = Math.floor(rand() * clWidth - 1.42 * sz); // 1.42 ~ sqrt(2) - const y = Math.floor(rand() * clHeight * 0.8); star.style.transform = `translateX(${x}px) translateY(${y}px) rotate(${rot}deg)`; star.style.animationDuration = `${animDuration}s`; star.style.fontSize = `${sz}px`; @@ -352,14 +362,14 @@ ); let x, y; outerLoop: while (true) { - x = Math.floor(rand() * clWidth - 22.64 * rem) + 11.32 * rem; // 11.32 ~ 8 * sqrt(2) - y = Math.floor(rand() * clHeight - 22.64 * rem) + 11.32 * rem; + x = Math.floor(rand() * clWidth - 20 * vmin); + y = Math.floor(rand() * clHeight - 20 * vmin); for (j = 0; j < i - 1; j++) { const xd = frameCenters[j].x - x; const yd = frameCenters[j].y - y; if ( Math.sqrt(xd * xd + yd * yd) < - 23 * rem + 30 * vmin ) { continue outerLoop; } @@ -704,6 +714,17 @@ } }); + function calculateVmax(percent) { + const viewportWidth = window.innerWidth; + const viewportHeight = window.innerHeight; + + const largerDimension = Math.max(viewportWidth, viewportHeight); + + const vmaxValue = (largerDimension / 100) * percent; + + return vmaxValue; + } + function positionThemeIcons() { const sliceAngle = 360 / themeIcons.length; diff --git a/views/partials/general-page-header.html b/views/partials/general-page-header.html index a75d32f..ce77b5c 100644 --- a/views/partials/general-page-header.html +++ b/views/partials/general-page-header.html @@ -1,4 +1,4 @@ -<title>{{ or .PageTitle .Title }}</title> +<title>{{ .Title }} // SAYA.UZ</title> <div class="flex flex-row mb-2"> {{ block "header" . }}{{ end }} <h1 |