style tweaks #8
|
@ -8,6 +8,7 @@
|
|||
|
||||
import type { Article } from '$lib/article';
|
||||
export let data: Article;
|
||||
const isUpdated = data.updated_at.getTime() != data.released_at.getTime();
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
|
@ -17,7 +18,7 @@
|
|||
<meta property="og:image" content={data.image} />
|
||||
<meta property="og:type" content="article" />
|
||||
<meta property="article:published_time" content={data.released_at.toISOString()} />
|
||||
{#if data.updated_at}
|
||||
{#if isUpdated}
|
||||
<meta property="article:modified_time" content={data.updated_at.toISOString()} />
|
||||
{/if}
|
||||
<meta property="article:author" content="HareWorks" />
|
||||
|
@ -36,7 +37,7 @@
|
|||
<div class="meta">
|
||||
<span>
|
||||
released <FormattedDate date={data.released_at} />
|
||||
{#if data.updated_at}<br />
|
||||
{#if isUpdated}<br />
|
||||
updated <FormattedDate date={data.updated_at} />
|
||||
{/if}
|
||||
</span>
|
||||
|
|
|
@ -119,7 +119,7 @@ export default async function init(db: Postgres) {
|
|||
const category = path.split('/')[3];
|
||||
const tags: string[] = compiled.data.fm.tags;
|
||||
const released_at = new Date(compiled.data.fm.released_at);
|
||||
const updated_at = new Date(compiled.data.fm.updated_at);
|
||||
const updated_at = (compiled.data.fm.updated_at !== null) ? new Date(compiled.data.fm.updated_at) : released_at;
|
||||
const image = compiled.data.fm.image;
|
||||
const publish = compiled.data.fm.publish;
|
||||
const content = compiled.code
|
||||
|
|
|
@ -22,7 +22,7 @@ export const load: PageServerLoad = async ({ params, locals }) => {
|
|||
return data
|
||||
} catch (e) {
|
||||
await db.rollback();
|
||||
error(500, (e as Error).message);
|
||||
error(404, 'Not found');
|
||||
} finally {
|
||||
await db.release();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export const load: PageServerLoad = async ({ params, locals }) => {
|
|||
return data
|
||||
} catch (e) {
|
||||
await db.rollback();
|
||||
error(500, (e as Error).message);
|
||||
error(404, 'Not found');
|
||||
} finally {
|
||||
await db.release();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user