Skip to content

Commit

Permalink
fix: don't consider publications without cover page assets for front …
Browse files Browse the repository at this point in the history
…page sample
  • Loading branch information
kevinstadler committed Oct 25, 2024
1 parent eda3fa7 commit fd5c333
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/(index)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export default async function IndexPage(_props: IndexPageProps) {
// const t = useTranslations("IndexPage");

const pubs = await getPublications({
// filter non-erstpublikationen and missing cover assets
filter_by: "erstpublikation:true && has_image:true",

// TODO workaround until upgrade to typesense 0.28, afterwards can just use: "_rand:asc"
// just look for a single random letter a-w (ASCII 65-87)
q: String.fromCharCode(Math.floor(65 + 22 * Math.random())),
Expand Down
5 changes: 3 additions & 2 deletions lib/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ export async function getPublication(id: string) {

export async function getPublications({
q = "*",
_filter = {},
filter_by = "",
query_by = "title, contains.title",
page = 1,
per_page = 12,
sort_by = undefined,
}: {
q: string;
_filter?: Partial<Publication>;
filter_by: string;
query_by?: string;
page?: number;
per_page?: number;
Expand All @@ -63,6 +63,7 @@ export async function getPublications({
.search({
q: q,
query_by: query_by,
filter_by: filter_by,
sort_by: sort_by,
page: page,
per_page: per_page,
Expand Down

0 comments on commit fd5c333

Please sign in to comment.