Read portal SEO origin from request context

SNI middleware already stores scheme://host; SEOFromRequest
no longer takes a base URL or re-strips the path. Expose
context helpers and drop the obsolete strip tests.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-07-22 12:19:25 +02:00
parent 9ee0df4d3f
commit 52310dbf65
5 changed files with 57 additions and 115 deletions

View File

@@ -20,7 +20,6 @@ import (
"github.com/go-chi/chi/v5"
"go.gearno.de/kit/log"
"go.gearno.de/x/ref"
"go.probo.inc/probo/pkg/baseurl"
visitor "go.probo.inc/probo/pkg/complianceportal/visitor"
"go.probo.inc/probo/pkg/esign"
@@ -140,19 +139,15 @@ func compliancePageHeadData() HeadDataFunc {
description = *tc.Description
}
headData := HeadData{
Title: tc.Title,
Description: description,
}
htmlLang, canonical, hreflang := SEOFromRequest(r)
// Canonical / hreflang / og:url must be absolute. Without a portal
// origin in context, skip them rather than emit relative paths.
if pageBase := ref.UnrefOrZero(compliancePageBaseURL); pageBase != "" {
htmlLang, canonical, hreflang := SEOFromRequest(r, pageBase)
headData.HTMLLang = htmlLang
headData.OGURL = canonical
headData.CanonicalURL = canonical
headData.Hreflang = hreflang
headData := HeadData{
Title: tc.Title,
Description: description,
HTMLLang: htmlLang,
OGURL: canonical,
CanonicalURL: canonical,
Hreflang: hreflang,
}
if tc.LogoFileID != nil && compliancePageBaseURL != nil {