mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Include stylesheet in static file generation
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
<svelte:head>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<link rel="stylesheet" href="../styles.css" />
|
||||
</head>
|
||||
</svelte:head>
|
||||
|
||||
@@ -28,7 +29,9 @@
|
||||
</nav>
|
||||
|
||||
<header>
|
||||
<img src={coverImage} alt="" />
|
||||
{#if coverImage}
|
||||
<img src={coverImage} alt="" />
|
||||
{/if}
|
||||
<h1>{title}</h1>
|
||||
<p>{publicationDate}</p>
|
||||
</header>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<svelte:head>
|
||||
<head>
|
||||
<title>{title}</title>
|
||||
<link rel="stylesheet" href="./styles.css" />
|
||||
</head>
|
||||
</svelte:head>
|
||||
|
||||
@@ -45,7 +46,9 @@
|
||||
<h3>
|
||||
<a href="./articles/{articleFileName}.html">{article.title}</a>
|
||||
</h3>
|
||||
<p>{article.meta_description ?? "No description provided"}</p>
|
||||
{#if article.meta_description}
|
||||
<p>{article.meta_description}</p>
|
||||
{/if}
|
||||
</article>
|
||||
{/each}
|
||||
</section>
|
||||
|
||||
18
web-app/src/lib/templates/blog/styles.css
Normal file
18
web-app/src/lib/templates/blog/styles.css
Normal file
@@ -0,0 +1,18 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
}
|
||||
|
||||
body {
|
||||
margin-inline: auto;
|
||||
inline-size: min(100% - 2rem, 75ch);
|
||||
line-height: 1.5;
|
||||
font-family: system-ui, sans-serif;
|
||||
}
|
||||
|
||||
img,
|
||||
picture,
|
||||
svg,
|
||||
video {
|
||||
max-inline-size: 100%;
|
||||
block-size: auto;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { readFile, mkdir, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { md } from "$lib/utils";
|
||||
import type { Actions, PageServerLoad } from "./$types";
|
||||
@@ -85,7 +85,9 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
||||
title: article.title,
|
||||
logoType: websiteData.logo_type,
|
||||
logo: websiteData.logo_text,
|
||||
coverImage: `${API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`,
|
||||
coverImage: article.cover_image
|
||||
? `${API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
||||
: "",
|
||||
publicationDate: article.publication_date,
|
||||
mainContent: md.render(article.main_content ?? ""),
|
||||
footerAdditionalText: websiteData.additional_text ?? ""
|
||||
@@ -96,4 +98,9 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
||||
|
||||
await writeFile(join(uploadDir, "articles", `${articleFileName}.html`), articleFileContents);
|
||||
}
|
||||
|
||||
const styles = await readFile(`${process.cwd()}/src/lib/templates/blog/styles.css`, {
|
||||
encoding: "utf-8"
|
||||
});
|
||||
await writeFile(join(uploadDir, "styles.css"), styles);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user