Skip to content

Commit

Permalink
feat: add seo for index page (#1)
Browse files Browse the repository at this point in the history
* feat: add seo for index page

* fix: move head to svelte layout

* chore: TOI

---------

Co-authored-by: Nutthapat Pongtanyavichai <[email protected]>
  • Loading branch information
khajornritdacha and leomotors authored Apr 26, 2023
1 parent 2c1723e commit 980639e
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 11 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"node-fetch": "^3.3.1",
"prettier-plugin-tailwindcss": "^0.2.7",
"pretty-quick": "^3.1.3",
"schema-dts": "^1.1.2",
"svelte-bootstrap-icons": "^2.3.1"
},
"engines": {
Expand Down
12 changes: 11 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Pre TOI 19</title>
<meta name="description" content="การแข่งขัน Crack 'n' Code ในวันที่ 13-14 พฤษภาคม 2566" />
<!--
<link rel="icon" href="%sveltekit.assets%/crackncode.webp" />
-->
<link rel="icon" href="%sveltekit.assets%/cncxcodeblitz.png" />
<link rel="icon" href="%sveltekit.assets%/cncxcodeblitz.webp" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans+Thai" />

<!-- For google's verification -->
<meta name="google-site-verification" content="qRdSoVMowAFZPds4O92p_c-Ca5KnujbMub4EbFLr5RM" />
%sveltekit.head%
</head>

Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/NavBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<a href="/" class="flex items-center transition-colors hover:text-neutral-300 lg:gap-3">
<img
class="scale-[.66] cursor-pointer lg:scale-100"
src="/cncxcodeblitz.png"
src="/cncxcodeblitz.webp"
width="70"
alt="Crack 'n' Code x CodeBlitz Logo"
/>
Expand Down
8 changes: 8 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
import Footer from "$components/layout/Footer.svelte";
</script>

<svelte:head>
<title>Crack 'n' Code x CodeBlitz Pre TOI19</title>
<meta
name="description"
content="การแข่งขัน Pre TOI19 จัดโดย Crack 'n' Code และ CodeBlitz ในวันที่ 13-14 พฤษภาคม 2566 เวลา 19.00-22.00 น."
/>
</svelte:head>

<div class="relative overflow-x-hidden">
<NavBar />
<main class="min-h-[calc(100vh-18rem)] p-4 lg:min-h-[calc(100vh-16.5rem)]">
Expand Down
5 changes: 3 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
import PrizeList from "$components/PrizeList.svelte";
import CountDown from "$components/CountDown.svelte";
import { serializeJsonLd, websiteSchema } from "$utils/json-ld";
</script>

<svelte:head>
<title>Crack 'n' Code x CodeBlitz Pre TOI19</title>
<meta name="description" content="Crack 'n' Code is online programming contest organizer" />
{@html serializeJsonLd(websiteSchema)}
</svelte:head>

<main class="page">
Expand Down
30 changes: 30 additions & 0 deletions src/utils/json-ld.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Thing, WithContext, Event } from "schema-dts";

export type Schema = Thing | WithContext<Thing>;

export function serializeJsonLd(data: Schema): string {
return `<script type="application/ld+json">${JSON.stringify(data, null, 2)}</script>`;
}

export const websiteSchema: WithContext<Event> = {
"@context": "https://schema.org",
"@type": "Event",
name: "Crack 'n' Code x CodeBlitz Pre TOI19",
startDate: "2023-05-14",
location: {
"@type": "Place",
name: "ผ่านระบบ CMS"
},
image: "https://pretoi19.crackncode.org/cncxcodeblitz.webp",
description:
"การแข่งขัน TOI19 ใกล้เข้ามาแล้ว อยากจะทดสอบฝีมือตัวเองใช่มั้ย คุณคิดว่าคุณพร้อมแค่ไหนกัน",
url: "https://forms.gle/QtSv4pD7e92WEhVCA",
performer: {
"@type": "Person",
name: "Crack n code x codeblitz"
},
offers: {
"@type": "Offer",
price: "รางวัล คะแนนรวมสูงสุด 16 อันดับแรก [first place prize] เสื้อ Crack 'n' Code X CodeBlitz"
}
};
Binary file removed static/cncxcodeblitz.png
Binary file not shown.
Binary file added static/cncxcodeblitz.webp
Binary file not shown.
3 changes: 2 additions & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const config = {
$components: path.resolve("src/components"),
$lib: path.resolve("src/lib"),
$styles: path.resolve("src/styles"),
$data: path.resolve("src/data")
$data: path.resolve("src/data"),
$utils: path.resolve("src/utils")
}
}
};
Expand Down

0 comments on commit 980639e

Please sign in to comment.