Skip to content

Commit

Permalink
use <Show>
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Aug 8, 2024
1 parent 88a5c8c commit d2b1d55
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions examples/full/pages/images/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Head } from "vike-solid/Head";
import logoOld from "../../assets/logo.svg";
import logoNew from "../../assets/logo-new.svg";
import { Counter } from "../../components/Counter";
import { Show } from "solid-js";

function Page() {
return (
Expand All @@ -29,19 +30,21 @@ function Image({ src, author }: { src: string; author: string }) {
return (
<>
<img src={src} height={48} style={{ "vertical-align": "middle", "margin-left": "10px" }} />
<Head>
<script
type="application/ld+json"
innerHTML={JSON.stringify({
"@context": "https://schema.org/",
contentUrl: { src },
creator: {
"@type": "Person",
name: author,
},
})}
></script>
</Head>
<Show when={import.meta.env.SSR}>
<Head>
<script
type="application/ld+json"
innerHTML={JSON.stringify({
"@context": "https://schema.org/",
contentUrl: { src },
creator: {
"@type": "Person",
name: author,
},
})}
></script>
</Head>
</Show>
</>
);
}

0 comments on commit d2b1d55

Please sign in to comment.