From d06e96c16d2fb5fd5b27ad28b83abdb0e241b8fb Mon Sep 17 00:00:00 2001 From: Pulkit Kathuria Date: Mon, 8 Jan 2024 05:02:04 +0900 Subject: [PATCH] GA conditional --- frontend/src/components/Layout.astro | 32 ++++++++++++++++++++-------- pkg/chart.go | 4 ++-- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/Layout.astro b/frontend/src/components/Layout.astro index 2a13988..44d9225 100644 --- a/frontend/src/components/Layout.astro +++ b/frontend/src/components/Layout.astro @@ -3,6 +3,7 @@ interface Props { title: string; description: string; } +const measurementID = import.meta.env.PUBLIC_GOOGLE_ANALYTICS_ID const { title, description } = Astro.props; --- @@ -14,8 +15,21 @@ const { title, description } = Astro.props; + {title} + {measurementID && ( + + + )} + + diff --git a/pkg/chart.go b/pkg/chart.go index 550577b..0afc3fc 100644 --- a/pkg/chart.go +++ b/pkg/chart.go @@ -68,8 +68,8 @@ func SetHeadersResponseImage(header http.Header, output string) { header.Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload") } func SetHeadersResponseHTML(header http.Header) { - header.Set("Cache-Control", "max-age=31536000") - header.Set("Expires", "31536000") + header.Set("Cache-Control", "max-age=86400") + header.Set("Expires", "86400") header.Set("Content-Type", "text/html; charset=utf-8") // security headers header.Set("X-Content-Type-Options", "nosniff")