mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
Remove unncessary fields from docs templates and add category article order
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
|
||||
<nav>
|
||||
<div class="container">
|
||||
{#if isDocsTemplate}
|
||||
{#if isDocsTemplate && Object.keys(categorizedArticles).length > 0}
|
||||
<input type="checkbox" id="toggle-sidebar" hidden />
|
||||
<label for="toggle-sidebar">
|
||||
<svg
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
logo,
|
||||
mainContent,
|
||||
categorizedArticles,
|
||||
coverImage,
|
||||
publicationDate,
|
||||
footerAdditionalText
|
||||
}: {
|
||||
favicon: string;
|
||||
@@ -20,8 +18,6 @@
|
||||
logo: string;
|
||||
mainContent: string;
|
||||
categorizedArticles: { [key: string]: { title: string }[] };
|
||||
coverImage: string;
|
||||
publicationDate: string;
|
||||
footerAdditionalText: string;
|
||||
} = $props();
|
||||
</script>
|
||||
@@ -32,13 +28,7 @@
|
||||
|
||||
<header>
|
||||
<div class="container">
|
||||
<hgroup>
|
||||
<p>{publicationDate}</p>
|
||||
<h1>{title}</h1>
|
||||
</hgroup>
|
||||
{#if coverImage}
|
||||
<img src={coverImage} alt="" />
|
||||
{/if}
|
||||
<h1>{title}</h1>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
logoType,
|
||||
logo,
|
||||
mainContent,
|
||||
articles,
|
||||
categorizedArticles,
|
||||
footerAdditionalText
|
||||
}: {
|
||||
@@ -18,7 +17,6 @@
|
||||
logoType: "text" | "image";
|
||||
logo: string;
|
||||
mainContent: string;
|
||||
articles: { title: string; publication_date: string; meta_description: string }[];
|
||||
categorizedArticles: { [key: string]: { title: string }[] };
|
||||
footerAdditionalText: string;
|
||||
} = $props();
|
||||
|
||||
@@ -10,7 +10,7 @@ export const load: PageServerLoad = async ({ params, fetch, cookies, url, parent
|
||||
let baseFetchUrl = `${API_BASE_PREFIX}/article?website_id=eq.${params.websiteId}&select=id,title`;
|
||||
if (website.content_type === "Docs") {
|
||||
baseFetchUrl +=
|
||||
",docs_category(category_name,category_weight)&order=docs_category(category_weight).desc.nullslast,article_weight.desc.nullslast";
|
||||
",article_weight,docs_category(category_name,category_weight)&order=docs_category(category_weight).desc.nullslast,article_weight.desc.nullslast";
|
||||
}
|
||||
|
||||
const parameters = new URLSearchParams();
|
||||
|
||||
@@ -76,10 +76,10 @@
|
||||
</details>
|
||||
|
||||
<ul class="unpadded">
|
||||
{#each data.articles as { id, title, docs_category } (id)}
|
||||
{#each data.articles as { id, title, article_weight, docs_category } (id)}
|
||||
<li class="article-card">
|
||||
<p>
|
||||
<strong>{title}</strong>
|
||||
<strong>{title} {article_weight ? `(${article_weight})` : ""}</strong>
|
||||
{#if docs_category?.category_name}
|
||||
<br />
|
||||
<small>
|
||||
|
||||
@@ -95,24 +95,34 @@
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Publication date:
|
||||
<input type="date" name="publication-date" value={data.article.publication_date} required />
|
||||
</label>
|
||||
<div class="file-field">
|
||||
|
||||
{#if data.website.content_type === "Blog"}
|
||||
<label>
|
||||
Cover image:
|
||||
<input type="file" name="cover-image" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
Publication date:
|
||||
<input
|
||||
type="date"
|
||||
name="publication-date"
|
||||
value={data.article.publication_date}
|
||||
required
|
||||
/>
|
||||
</label>
|
||||
{#if data.article.cover_image}
|
||||
<Modal id="preview-cover-article-{data.article.id}" text="Preview">
|
||||
<img
|
||||
src={`${data.API_BASE_PREFIX}/rpc/retrieve_file?id=${data.article.cover_image}`}
|
||||
alt=""
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<div class="file-field">
|
||||
<label>
|
||||
Cover image:
|
||||
<input type="file" name="cover-image" accept={ALLOWED_MIME_TYPES.join(", ")} />
|
||||
</label>
|
||||
{#if data.article.cover_image}
|
||||
<Modal id="preview-cover-article-{data.article.id}" text="Preview">
|
||||
<img
|
||||
src={`${data.API_BASE_PREFIX}/rpc/retrieve_file?id=${data.article.cover_image}`}
|
||||
alt=""
|
||||
/>
|
||||
</Modal>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<label>
|
||||
Main content:
|
||||
<textarea
|
||||
|
||||
@@ -97,7 +97,6 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
||||
? websiteData.logo_text
|
||||
: `${API_BASE_PREFIX}/rpc/retrieve_file?id=${websiteData.logo_image}`,
|
||||
mainContent: md(websiteData.main_content ?? "", false),
|
||||
articles: websiteData.articles ?? [],
|
||||
categorizedArticles: websiteData.categorized_articles ?? [],
|
||||
footerAdditionalText: md(websiteData.additional_text ?? "")
|
||||
}
|
||||
@@ -165,10 +164,6 @@ const generateStaticFiles = async (websiteData: any, isPreview: boolean = true)
|
||||
websiteData.logo_type === "text"
|
||||
? websiteData.logo_text
|
||||
: `${API_BASE_PREFIX}/rpc/retrieve_file?id=${websiteData.logo_image}`,
|
||||
coverImage: article.cover_image
|
||||
? `${API_BASE_PREFIX}/rpc/retrieve_file?id=${article.cover_image}`
|
||||
: "",
|
||||
publicationDate: article.publication_date,
|
||||
mainContent: md(article.main_content ?? ""),
|
||||
categorizedArticles: websiteData.categorized_articles ?? [],
|
||||
footerAdditionalText: md(websiteData.additional_text ?? "")
|
||||
|
||||
Reference in New Issue
Block a user