summaryrefslogtreecommitdiffhomepage
path: root/packages/web/src/pages/s/index.astro
blob: a6b74ecdee8120722efaea164e69de846220abae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
import config from "virtual:starlight/user-config";

import StarlightPage from '@astrojs/starlight/components/StarlightPage.astro';
import Share from "../../components/Share.tsx";

const apiUrl = import.meta.env.VITE_API_URL;

const id = Astro.url.searchParams.get('id')
const res = await fetch(`${apiUrl}/share_data?id=${id}`);
const data = await res.json();

const title = data.info.title;
const ogImage = data.ogImage;

---
<StarlightPage
  hasSidebar={false}
  frontmatter={{
    title: title,
    pagefind: false,
    template: "splash",
    tableOfContents: false,
    head: [
      {
        tag: "meta",
        attrs: {
          property: "og:image",
          content: ogImage,
        },
      },
      {
        tag: "meta",
        attrs: {
          name: "twitter:image",
          content: ogImage,
        },
      },
    ],
  }}
>
  <Share api={apiUrl} info={data.info} messages={data.messages} client:only="solid" />
</StarlightPage>

<style is:global>
body > .page > .main-frame .main-pane > main > .content-panel:first-of-type {
  display: none;
}
body > .page > .main-frame .main-pane > main > .content-panel + .content-panel {
  border-top: none !important;
}
</style>