Moving between tags or articles now works

This commit is contained in:
Fred Boniface 2023-08-22 20:59:22 +01:00
parent 2328812858
commit cbd187bd21
4 changed files with 10 additions and 7 deletions

View File

@ -44,7 +44,6 @@ export async function load({ params }) {
function renderMarkdown(md: string, renderer: _Renderer): string {
const rawHtml = marked(md, { renderer });
console.log(rawHtml);
const sanitizedHtml = sanitizeHtml(rawHtml, {
allowedTags: ['a', 'br', 'code', 'figcaption', 'figure', 'img', 'p', 'pre'],
allowedAttributes: {
@ -52,6 +51,5 @@ function renderMarkdown(md: string, renderer: _Renderer): string {
img: ['alt', 'class', 'src', 'title']
}
});
console.log(sanitizedHtml);
return sanitizedHtml;
}

View File

@ -1,4 +1,5 @@
<script lang="ts">
import LatestPosts from '$lib/card-collections/LatestPosts.svelte';
import Projects from '$lib/card-collections/Projects.svelte';
import Header from '$lib/header.svelte';
import PostTag from '$lib/posts/PostTag.svelte';
@ -7,7 +8,9 @@
export let data: any;
const post: Article = data.data;
let post: Article;
$: post = data.data;
afterUpdate(() => {
const codeBlocks = document.querySelectorAll('article pre');
@ -59,7 +62,7 @@
<div class="side-column">
<h2>Projects</h2>
<Projects />
<LatestPosts />
</div>
</div>

View File

@ -4,9 +4,11 @@
import type { ArticleSummary } from '$lib/posts/types.js';
export let data;
const posts: ArticleSummary[] = JSON.parse(data.data);
let posts: ArticleSummary[];
$: posts = JSON.parse(data.data);
const title = `tag: ${data.tag}`;
let title: string;
$: title = `tag: ${data.tag}`;
</script>
<Header {title} />

View File

@ -9,4 +9,4 @@ export async function GET({ url }) {
const col = db.db('fredboniface').collection('posts');
const res = await col.distinct('tags');
return json(res);
}
}