Skip to content

Commit 3c6a9f6

Browse files
authored
Fix showing new id.ai landing page briefly when visiting legacy domains (#3412)
* Fix showing new id.ai landing page briefly when visiting legacy domains by hiding the SSG page until SvelteKit has mounted. * Include legacy beta domains.
1 parent 8ab675d commit 3c6a9f6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/frontend/src/app.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@
3434
/>
3535
<meta name="twitter:creator" content="@dfinity" />
3636
<link rel="canonical" href="https://id.ai/" />
37+
<style>
38+
html[data-temp-hide-ssg="true"] body > div {
39+
display: none !important;
40+
}
41+
</style>
42+
<script>
43+
// Hide page until it has fully loaded on legacy domains,
44+
// this avoids showing the SSG page on these domains.
45+
if (
46+
window.location.hostname.startsWith("identity.") ||
47+
window.location.hostname.startsWith("beta.identity.")
48+
) {
49+
document.documentElement.setAttribute("data-temp-hide-ssg", "true");
50+
}
51+
</script>
3752
%sveltekit.head%
3853
</head>
3954

src/frontend/src/routes/+layout.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
const { children } = $props();
77
88
onMount(() => {
9+
// Show page once it has fully loaded (see app.html)
10+
document.documentElement.removeAttribute("data-temp-hide-ssg");
11+
912
initAnalytics(canisterConfig.analytics_config[0]?.[0]);
1013
analytics.pageView();
1114
});

0 commit comments

Comments
 (0)