Skip to content

Commit

Permalink
Make sure svelte can resolve all 'dynamic' pages
Browse files Browse the repository at this point in the history
  • Loading branch information
matekdev committed Nov 11, 2023
1 parent 9ae20ef commit 3ac3862
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/Nav-Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{invertColors ? 'text-blue' : 'text-white'}
{invertColors ? 'hover:text-white' : 'hover:text-blue'}
{invertColors ? 'hover:bg-blue' : 'hover:bg-white'}
{disabled ? 'opacity-50 pointer-events-none' : ''}"
{disabled ? 'opacity-75 pointer-events-none' : ''}"
>
<Icon {icon} class="text-4xl mr-2" />
<p>{label}</p>
Expand Down
2 changes: 1 addition & 1 deletion src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
href={route.href}
icon={route.icon}
label={route.label}
invertColors={false}
invertColors={$page.url.pathname != '/'}
disabled={$page.url.pathname == route.href}
/>
{/each}
Expand Down
19 changes: 19 additions & 0 deletions src/routes/blog/[slug]/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { EntryGenerator } from './$types';
import { SlugFromPath } from '$lib/slugFromPath';

export const entries: EntryGenerator = async () => {
const modules = import.meta.glob(`/src/blogs/*.{md,svx,svelte.md}`);
const postPromises = Object.entries(modules).map(([path, resolver]) =>
resolver().then(
(post) =>
({
slug: SlugFromPath(path),
...(post as unknown as App.MdsvexFile).metadata
}) as App.BlogPost
)
);

const posts = await Promise.all(postPromises);
return posts;
};
export const prerender = true;

0 comments on commit 3ac3862

Please sign in to comment.