Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Aug 6, 2024
1 parent d2d95bf commit 875db34
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/full/pages/+Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function Layout(props: { children?: JSX.Element }) {
<Link href="/without-ssr">Without SSR</Link>
<Link href="/starship">Nested Layout 1</Link>
<Link href="/stardust">Nested Layout 2</Link>
<Link href="/images">Head Component</Link>
</Sidebar>
<Content>{props.children}</Content>
</div>
Expand Down
46 changes: 46 additions & 0 deletions examples/full/pages/images/+Page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
export { Page };

import { Head } from "vike-solid/Head";
import logoOld from "../../assets/logo.svg";
import logoNew from "../../assets/logo-new.svg";
import { Counter } from "../../components/Counter";

function Page() {
return (
<>
<p>
Page showcasing <code>{"<Image>"}</code> component, with structured data (see HTML).
</p>
<div>
New logo: <Image src={logoNew} author="brillout" />
</div>
<br />
<div>
Old logo: <Image src={logoOld} author="Romuald Brillout" />
</div>
<br />
<Counter />
</>
);
}

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>
</>
);
}

0 comments on commit 875db34

Please sign in to comment.