Blog-Übersicht: Featured-Hero, Neu-Badge, Org-Sektion, Sortierung, konsolidiertes Suchfeld
- SearchField-Atom (src/lib/ui/SearchField.svelte, light/dark) in Kalender, Beiträge und globaler Suche einheitlich eingesetzt - Featured-Hero (neuester Beitrag groß, Seite 1 ungefiltert, nur bei "newest") - Neu-Badge in PostCard (Beitrag < 7 Tage) - Org-/BI-Tags (tag-org-*) in eigene Sektion; Tags ohne Beiträge ausgeblendet - Inline-Newsletter-CTA, prominenter RSS-Link - Sortierung Neueste/Älteste (Server-Param + URL-State, Toggle neben Pagination, Pagination trägt sort weiter) - Pagination als Pills (rounded-full) - Kalender: Tag-Filter einklappbar, Filterleiste mit Suche + Heute Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -270,6 +270,8 @@ export function buildPostSearchIndex(posts: PostEntry[]): PostSearchIndexEntry[]
|
||||
});
|
||||
}
|
||||
|
||||
export type PostSortOrder = "newest" | "oldest";
|
||||
|
||||
export type LoadPostsResult = {
|
||||
posts: PostEntry[];
|
||||
tags: Awaited<ReturnType<typeof getTags>>;
|
||||
@@ -277,6 +279,7 @@ export type LoadPostsResult = {
|
||||
currentPage: number;
|
||||
totalPages: number;
|
||||
totalPosts: number;
|
||||
sort: PostSortOrder;
|
||||
upcomingEvents: PostEntry[];
|
||||
searchIndex: PostSearchIndexEntry[];
|
||||
tagName: string | null;
|
||||
@@ -287,9 +290,11 @@ export type LoadPostsResult = {
|
||||
export async function loadPostsList(opts: {
|
||||
tagSlug?: string | null;
|
||||
page?: number;
|
||||
sort?: PostSortOrder;
|
||||
}): Promise<LoadPostsResult> {
|
||||
const tagSlug = opts.tagSlug ?? null;
|
||||
const requestedPage = Math.max(1, opts.page ?? 1);
|
||||
const sort: PostSortOrder = opts.sort === "oldest" ? "oldest" : "newest";
|
||||
const perPage = getPostsPerPage();
|
||||
|
||||
let posts: PostEntry[] = [];
|
||||
@@ -351,7 +356,10 @@ export async function loadPostsList(opts: {
|
||||
cmsError = e instanceof Error ? e.message : String(e);
|
||||
}
|
||||
|
||||
const filtered = filterPostsByTag(posts, tagSlug);
|
||||
const filteredByTag = filterPostsByTag(posts, tagSlug);
|
||||
// posts sind bereits neueste-zuerst sortiert; „oldest" = umgekehrte Reihenfolge.
|
||||
const filtered =
|
||||
sort === "oldest" ? [...filteredByTag].reverse() : filteredByTag;
|
||||
const totalPages = getTotalPages(filtered.length, perPage);
|
||||
const pageNum = Math.min(requestedPage, totalPages);
|
||||
const pagePosts = paginate(filtered, pageNum, perPage);
|
||||
@@ -370,6 +378,7 @@ export async function loadPostsList(opts: {
|
||||
currentPage: pageNum,
|
||||
totalPages,
|
||||
totalPosts: filtered.length,
|
||||
sort,
|
||||
upcomingEvents,
|
||||
searchIndex,
|
||||
tagName,
|
||||
|
||||
Reference in New Issue
Block a user