Skip to content

Commit 05c5509

Browse files
committed
✨ improve discord embeds again
1 parent 159e76a commit 05c5509

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

src/routes/+layout.svelte

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,30 @@
22
import '$lib/styles/global.css'
33
import '$lib/styles/minecraftUI.css'
44
5-
let { children } = $props()
5+
const { children } = $props()
6+
const siteUrl = 'https://animated-java.github.io'
7+
const pageTitle = 'Animated Java'
8+
const pageDescription = 'Effortlessly craft complex animations for Minecraft: Java Edition'
9+
const socialImage = `${siteUrl}/images/armor_stand_wave.webp`
610
</script>
711

12+
<svelte:head>
13+
<title>{pageTitle}</title>
14+
<meta name="description" content={pageDescription} />
15+
<link rel="canonical" href={siteUrl} />
16+
17+
<meta property="og:type" content="website" />
18+
<meta property="og:site_name" content="Animated Java" />
19+
<meta property="og:title" content={pageTitle} />
20+
<meta property="og:description" content={pageDescription} />
21+
<meta property="og:url" content={siteUrl} />
22+
<meta property="og:image" content={socialImage} />
23+
<meta content="#00ACED" data-react-helmet="true" name="theme-color" />
24+
25+
<meta name="twitter:card" content="summary_large_image" />
26+
<meta name="twitter:title" content={pageTitle} />
27+
<meta name="twitter:description" content={pageDescription} />
28+
<meta name="twitter:image" content={socialImage} />
29+
</svelte:head>
30+
831
{@render children?.()}

src/routes/docs/+layout.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { docsNavLinks, docsSidebar, flattenDocLinks, type DocLeaf } from '$lib/docs/navigation'
22

3-
const flattenedDocs = flattenDocLinks(docsSidebar)
3+
const FLATTENED_DOCS = flattenDocLinks(docsSidebar)
44

55
function normalizedPath(pathname: string): string {
66
if (!pathname || pathname === '/') return '/docs/welcome'
@@ -10,15 +10,15 @@ function normalizedPath(pathname: string): string {
1010

1111
export function load({ url }: { url: URL }) {
1212
const currentPath = normalizedPath(url.pathname)
13-
const currentIndex = flattenedDocs.findIndex(doc => doc.to === currentPath)
14-
const currentDoc = currentIndex >= 0 ? flattenedDocs[currentIndex] : null
13+
const currentIndex = FLATTENED_DOCS.findIndex(doc => doc.to === currentPath)
14+
const currentDoc = currentIndex >= 0 ? FLATTENED_DOCS[currentIndex] : null
1515

1616
let previous: DocLeaf | null = null
1717
let next: DocLeaf | null = null
1818

1919
if (currentIndex >= 0) {
20-
previous = currentIndex > 0 ? flattenedDocs[currentIndex - 1] : null
21-
next = currentIndex < flattenedDocs.length - 1 ? flattenedDocs[currentIndex + 1] : null
20+
previous = currentIndex > 0 ? FLATTENED_DOCS[currentIndex - 1] : null
21+
next = currentIndex < FLATTENED_DOCS.length - 1 ? FLATTENED_DOCS[currentIndex + 1] : null
2222
}
2323

2424
return {

0 commit comments

Comments
 (0)