| -rw-r--r-- | .github/workflows/build-and-deploy-prod.yml | 2 | ||||
| -rw-r--r-- | config/config.go | 5 | ||||
| -rw-r--r-- | config/config.prod.yaml | 2 | ||||
| -rw-r--r-- | deploy/playbook.yml | 1 | ||||
| -rw-r--r-- | internal/router/handlers/root.go | 8 | ||||
| -rw-r--r-- | internal/router/router.go | 3 | ||||
| -rw-r--r-- | views/layouts/general-page.html | 2 |
7 files changed, 4 insertions, 19 deletions
diff --git a/.github/workflows/build-and-deploy-prod.yml b/.github/workflows/build-and-deploy-prod.yml index 24b6e0e..413f402 100644 --- a/.github/workflows/build-and-deploy-prod.yml +++ b/.github/workflows/build-and-deploy-prod.yml @@ -75,4 +75,4 @@ jobs: ANSIBLE_HOST_KEY_CHECKING: False working-directory: ./deploy run: | - ansible-playbook -i inventory.yml -l prod playbook.yml --private-key ~/.ssh/id_ed25519 -u svc_github -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" -e saya_today_web_b2_key_id="${{ secrets.B2_KEY_ID }}" -e saya_today_web_b2_application_key="${{ secrets.B2_APPLICATION_KEY }}" -e saya_today_web_environment=prod -e saya_today_web_tag=${{ github.ref_name }} -e saya_today_web_mail_salt="${{ secrets.MAIL_SALT }}" -e saya_today_web_mail_host="${{ secrets.MAIL_HOST }}" -e saya_today_web_mail_address="${{ secrets.MAIL_ADDRESS }}" -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 }}" + ansible-playbook -i inventory.yml -l prod playbook.yml --private-key ~/.ssh/id_ed25519 -u svc_github -e saya_today_web_auth_salt="${{ secrets.AUTH_SALT }}" -e saya_today_web_b2_key_id="${{ secrets.B2_KEY_ID }}" -e saya_today_web_b2_application_key="${{ secrets.B2_APPLICATION_KEY }}" -e saya_today_web_environment=prod -e saya_today_web_tag=${{ github.ref_name }} -e saya_today_web_mail_salt="${{ secrets.MAIL_SALT }}" -e saya_today_web_mail_host="${{ secrets.MAIL_HOST }}" -e saya_today_web_mail_address="${{ secrets.MAIL_ADDRESS }}" -e saya_today_web_mail_username="${{ secrets.MAIL_USERNAME }}" -e saya_today_web_mail_password="${{ secrets.MAIL_PASSWORD }}" diff --git a/config/config.go b/config/config.go index eb4a91d..fd8c480 100644 --- a/config/config.go +++ b/config/config.go @@ -17,7 +17,6 @@ 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"` } type BlogPagesConfig struct { @@ -78,10 +77,6 @@ type TriggerConfig struct { OnNewPost string `json:"OnNewPost" yaml:"onNewPost" validate:"cron,required"` } -type MetaConfig struct { - GoogleSiteVerification string `json:"GoogleSiteVerification" yaml:"googleSiteVerification"` -} - func LoadConfig(path string, config *Config) error { fileBytes, err := os.ReadFile(path) if err != nil { diff --git a/config/config.prod.yaml b/config/config.prod.yaml index b40ba57..4de853c 100644 --- a/config/config.prod.yaml +++ b/config/config.prod.yaml @@ -45,5 +45,3 @@ mail: trigger: onNewPost: "0/5 * * * *" canonicalEndpoint: 'https://${FQDN}' -meta: - googleSiteVerification: '${GOOGLE_SITE_VERIFICATION}' diff --git a/deploy/playbook.yml b/deploy/playbook.yml index b0202bd..2516f4e 100644 --- a/deploy/playbook.yml +++ b/deploy/playbook.yml @@ -24,7 +24,6 @@ MAIL_PASSWORD: "{{ saya_today_web_mail_password }}" MAIL_SALT: "{{ saya_today_web_mail_salt }}" FQDN: "{{ saya_today_web_listen_address }}" - GOOGLE_SITE_VERIFICATION: "{{ saya_today_google_site_verification | default('') }}" network_mode: caddy networks: - name: caddy diff --git a/internal/router/handlers/root.go b/internal/router/handlers/root.go index a8890fa..cd01fcd 100644 --- a/internal/router/handlers/root.go +++ b/internal/router/handlers/root.go @@ -41,16 +41,12 @@ func (r *RootHandler) SitemapInfo(_ *router.Supplements) []router.SitemapInfo { } func (r *RootHandler) AddMeta(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (meta []router.MetaField, err error) { - meta = []router.MetaField{ + return []router.MetaField{ {Property: "og:title", Content: "Saya Blog"}, {Property: "og:description", Content: "The blog of a 25 years old, travelling God knows where, proud to be not mainstream // Личный блог 25-летки, странствующего по ебеням, зато не мейнстрим"}, {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}) - } - return meta, nil + }, nil } func (r *RootHandler) RenderBody(c *fiber.Ctx, supplements *router.Supplements, _ string, templateMap fiber.Map) (statusCode int, err error) { diff --git a/internal/router/router.go b/internal/router/router.go index 3242759..0d0ce8c 100644 --- a/internal/router/router.go +++ b/internal/router/router.go @@ -100,7 +100,6 @@ type Supplements struct { BlogTrigger *blogtrigger.BlogTriggerScheduler TemplateManager *templatemanager.TemplateManager MarkdownRenderer goldmark.Markdown - Meta config.MetaConfig } type Router struct { @@ -216,8 +215,6 @@ func NewRouter(cfg *config.Config) (*Router, error) { return nil, fmt.Errorf("fail to initialize template manager: %w", err) } - supplements.Meta = cfg.Meta - enablePrintRoutes := false if cfg.LogLevel <= slog.LevelDebug { enablePrintRoutes = true diff --git a/views/layouts/general-page.html b/views/layouts/general-page.html index 2d3bff3..7167d12 100644 --- a/views/layouts/general-page.html +++ b/views/layouts/general-page.html @@ -6,7 +6,7 @@ {{- range .Meta }} <meta {{with .Name}}name="{{.}}" {{end}}{{with .Property}}property="{{.}}" {{end}}{{with .Content}}content="{{.}}"{{end}}> {{- if eq .Property "og:description" }} - <meta name="description" content="{{.Content}}"> + <meta name="description" href="{{.Content}}"> {{- end }} {{- if eq .Property "og:url" }} <link rel="canonical" href="{{.Content}}"> |