Add SEO controls and sitemap for compliance pages
Add search engine indexing toggle, robots.txt, and sitemap.xml generation for compliance pages. Replace checkboxes with toggle components in the compliance page UI and add an "Open" button in the page header to quickly access the live compliance page. The search engine indexing toggle is disabled when the compliance page is inactive. Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -41,3 +41,43 @@ func (h *Handler) HandleLLMsTxt(w http.ResponseWriter, r *http.Request) {
|
||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) HandleRobotsTxt(w http.ResponseWriter, r *http.Request) {
|
||||
tc := CompliancePageFromContext(r.Context())
|
||||
if tc == nil {
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
baseURL := CompliancePageBaseURLFromContext(r.Context())
|
||||
if baseURL == nil {
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
|
||||
if err := h.trustService.RenderRobotsTxt(r.Context(), w, tc.SearchEngineIndexing, *baseURL); err != nil {
|
||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Handler) HandleSitemap(w http.ResponseWriter, r *http.Request) {
|
||||
tc := CompliancePageFromContext(r.Context())
|
||||
if tc == nil {
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
baseURL := CompliancePageBaseURLFromContext(r.Context())
|
||||
if baseURL == nil {
|
||||
http.Error(w, "not found", http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/xml; charset=utf-8")
|
||||
|
||||
if err := h.trustService.RenderSitemap(r.Context(), w, tc.ID, tc.TenantID, *baseURL); err != nil {
|
||||
http.Error(w, "internal server error", http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +138,20 @@ enum TrustCenterVisibility
|
||||
)
|
||||
}
|
||||
|
||||
enum SearchEngineIndexing
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.SearchEngineIndexing"
|
||||
) {
|
||||
INDEXABLE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SearchEngineIndexingIndexable"
|
||||
)
|
||||
NOT_INDEXABLE
|
||||
@goEnum(
|
||||
value: "go.probo.inc/probo/pkg/coredata.SearchEngineIndexingNotIndexable"
|
||||
)
|
||||
}
|
||||
|
||||
enum ControlImplementationState
|
||||
@goModel(
|
||||
model: "go.probo.inc/probo/pkg/coredata.ControlImplementationState"
|
||||
@@ -1685,6 +1699,7 @@ type TrustCenter implements Node
|
||||
) {
|
||||
id: ID!
|
||||
active: Boolean!
|
||||
searchEngineIndexing: SearchEngineIndexing!
|
||||
logoFileUrl: String @goField(forceResolver: true)
|
||||
darkLogoFileUrl: String @goField(forceResolver: true)
|
||||
ndaFileName: String
|
||||
@@ -3893,6 +3908,7 @@ input UpdateOrganizationContextInput {
|
||||
input UpdateTrustCenterInput {
|
||||
trustCenterId: ID!
|
||||
active: Boolean
|
||||
searchEngineIndexing: SearchEngineIndexing
|
||||
}
|
||||
|
||||
input UploadTrustCenterNDAInput {
|
||||
|
||||
@@ -24,6 +24,7 @@ import (
|
||||
type TrustCenter struct {
|
||||
ID gid.GID `json:"id"`
|
||||
Active bool `json:"active"`
|
||||
SearchEngineIndexing coredata.SearchEngineIndexing `json:"searchEngineIndexing"`
|
||||
LogoFileURL *string `json:"logoFileUrl,omitempty"`
|
||||
DarkLogoFileURL *string `json:"darkLogoFileUrl,omitempty"`
|
||||
NdaFileName *string `json:"ndaFileName,omitempty"`
|
||||
@@ -53,9 +54,10 @@ func NewTrustCenter(tc *coredata.TrustCenter, file *coredata.File) *TrustCenter
|
||||
Organization: &Organization{
|
||||
ID: tc.OrganizationID,
|
||||
},
|
||||
Active: tc.Active,
|
||||
NdaFileName: ndaFileName,
|
||||
CreatedAt: tc.CreatedAt,
|
||||
UpdatedAt: tc.UpdatedAt,
|
||||
Active: tc.Active,
|
||||
SearchEngineIndexing: tc.SearchEngineIndexing,
|
||||
NdaFileName: ndaFileName,
|
||||
CreatedAt: tc.CreatedAt,
|
||||
UpdatedAt: tc.UpdatedAt,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2106,8 +2106,9 @@ func (r *mutationResolver) UpdateTrustCenter(ctx context.Context, input types.Up
|
||||
trustCenter, file, err := prb.TrustCenters.Update(
|
||||
ctx,
|
||||
&probo.UpdateTrustCenterRequest{
|
||||
ID: input.TrustCenterID,
|
||||
Active: input.Active,
|
||||
ID: input.TrustCenterID,
|
||||
Active: input.Active,
|
||||
SearchEngineIndexing: input.SearchEngineIndexing,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user