Automatic populatrion of tags
This commit is contained in:
parent
f728b54b02
commit
2328812858
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import PostCard from '$lib/card-collections/cards/PostCard.svelte';
|
||||
import Header from '$lib/header.svelte';
|
||||
import PostsSummary from '$lib/posts/PostsSummary.svelte';
|
||||
import type { ArticleSummary } from '$lib/posts/types.js';
|
||||
|
||||
export let data;
|
||||
@ -11,6 +11,6 @@
|
||||
|
||||
<Header {title} />
|
||||
|
||||
{#each posts as article}
|
||||
<PostsSummary {article} />
|
||||
{#each posts as post}
|
||||
<PostCard {post} />
|
||||
{/each}
|
||||
|
@ -7,25 +7,6 @@ import { mongoConnect } from '$lib/database/mongo.server';
|
||||
export async function GET({ url }) {
|
||||
const db = await mongoConnect();
|
||||
const col = db.db('fredboniface').collection('posts');
|
||||
// Fetch all possible array values for 'tags' and creata a local `tags` array to return
|
||||
// For now, a static array is used.
|
||||
return json(tags);
|
||||
const res = await col.distinct('tags');
|
||||
return json(res);
|
||||
}
|
||||
|
||||
const tags: string[] = [
|
||||
'svelte',
|
||||
'sveltekit',
|
||||
'python',
|
||||
'bash',
|
||||
'misc',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'go',
|
||||
'node',
|
||||
'express',
|
||||
'mongodb',
|
||||
'redis',
|
||||
'html',
|
||||
'css',
|
||||
'git'
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user