diff --git a/jsconfig.json b/jsconfig.json index 81def15..73b46e8 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -9,7 +9,8 @@ "skipLibCheck": true, "sourceMap": true, "strict": true, - "moduleResolution": "bundler" + "moduleResolution": "bundler", + "allowImportingTsExtensions": true } // Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files // diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..f259a5e --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,32 @@ +/* + * Provides post summaries to all pages. That means every page can access summaries + * for all posts on the website. +*/ + +import { posts } from './post/data.js'; + +// Basically the same as Post but might contain less infomation - save storage +type Summary = { + url : string, + title : string, + description : string, + creation_date : number, + modification_date: number, +}; + +export function load() { + let summaries : Summary[] = []; + + posts.map((post) => { + let summary : Summary = { + url: post.url, + title : post.title, + description : post.description, + creation_date : post.creation_date, + modification_date : post.modification_date + }; + summaries.push(summary); + }); + + return { summaries }; +} diff --git a/src/routes/+layout.js b/src/routes/+layout.ts similarity index 100% rename from src/routes/+layout.js rename to src/routes/+layout.ts diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 2fdf88b..08cce52 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,7 +1,18 @@ + +

The Deprived Devs

+

Recent posts on Deprived.dev

+