| -rw-r--r-- | .github/workflows/build-and-deploy-prod.yml | 3 | ||||
| -rw-r--r-- | config/config.go | 6 | ||||
| -rw-r--r-- | config/config.prod.yaml | 8 | ||||
| -rw-r--r-- | deploy/playbook.yml | 1 | ||||
| -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-- | views/partials/general-page-header.html | 2 |
8 files changed, 22 insertions, 13 deletions
diff --git a/.github/workflows/build-and-deploy-prod.yml b/.github/workflows/build-and-deploy-prod.yml index 060ae32..fc44571 100644 --- a/.github/workflows/build-and-deploy-prod.yml +++ b/.github/workflows/build-and-deploy-prod.yml @@ -99,4 +99,5 @@ jobs: -e saya_today_web_mail_username="${{ secrets.MAIL_USERNAME }}" \ -e saya_today_web_mail_password="${{ secrets.MAIL_PASSWORD }}" \ -e saya_today_google_site_verification="${{ secrets.GOOGLE_SITE_VERIFICATION }}" \ - -e saya_today_yandex_verification="${{ secrets.YANDEX_VERIFICATION }}" + -e saya_today_yandex_verification="${{ secrets.YANDEX_VERIFICATION }}" \ + -e saya_today_bing_verification="${{ secrets.BING_VERIFICATION }}" diff --git a/config/config.go b/config/config.go index 8ab1bfc..9185e6a 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 { - GoogleSiteVerification string `json:"GoogleSiteVerification" yaml:"googleSiteVerification"` - YandexVerification string `json:"YandexVerification" yaml:"yandexVerification"` + Name string `json:"Name" yaml:"name"` + Value string `json:"Value" yaml:"value"` } type PhotoStorageConfig struct { diff --git a/config/config.prod.yaml b/config/config.prod.yaml index ce0941d..6ec00d8 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -55,8 +55,12 @@ mail: onNewPost: "0/5 * * * *" canonicalEndpoint: "https://${FQDN}" meta: - googleSiteVerification: "${GOOGLE_SITE_VERIFICATION}" - yandexVerification: "${YANDEX_VERIFICATION}" + - name: google-site-verification + value: "${GOOGLE_SITE_VERIFICATION}" + - name: yandex-verification + value: "${YANDEX_VERIFICATION}" + - name: msvalidate.01 + value: "${BING_VERIFICATION}" photoStorage: full: baseUrl: https://cdn.saya.uz/photos/jpeg-full/%s diff --git a/deploy/playbook.yml b/deploy/playbook.yml index ae3e936..f725335 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -44,6 +44,7 @@ FQDN: "{{ saya_today_web_listen_address }}" GOOGLE_SITE_VERIFICATION: "{{ saya_today_google_site_verification | default('') }}" YANDEX_VERIFICATION: "{{ saya_today_yandex_verification | default('') }}" + BING_VERIFICATION: "{{ saya_today_bing_verification | default('') }}" network_mode: caddy networks: - name: caddy diff --git a/internal/router/handlers/lang-blog-title.go b/internal/router/handlers/lang-blog-title.go index 5a1155d..76dc335 100644 --- a/internal/router/handlers/lang-blog-title.go +++ b/internal/router/handlers/lang-blog-title.go @@ -156,7 +156,13 @@ 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 6a011e4..4fc4e31 100644 --- a/internal/router/handlers/root.go +++ b/internal/router/handlers/root.go @@ -47,11 +47,8 @@ func (r *RootHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lan {Property: "og:url", Content: fmt.Sprint(templateMap["CanonicalEndpoint"]) + "/"}, {Property: "og:type", Content: "website"}, } - 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}) + for _, field := range supplements.Meta { + meta = append(meta, router.MetaField{Name: field.Name, Content: field.Value}) } return meta, nil } diff --git a/internal/router/router.go b/internal/router/router.go index c8b5686..a11a934 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/views/partials/general-page-header.html b/views/partials/general-page-header.html index ce77b5c..a75d32f 100644 --- a/views/partials/general-page-header.html +++ b/views/partials/general-page-header.html @@ -1,4 +1,4 @@ -<title>{{ .Title }} // SAYA.UZ</title> +<title>{{ or .PageTitle .Title }}</title> <div class="flex flex-row mb-2"> {{ block "header" . }}{{ end }} <h1 |