Skip to content

Instantly share code, notes, and snippets.

View TanyaMushonga's full-sized avatar

Tanyaradzwa T Mushonga TanyaMushonga

View GitHub Profile
@adrianhajdin
adrianhajdin / buildQuery.ts
Created September 18, 2023 13:34
How I Made My Website Load in 0.364 Seconds | Build and Deploy
export function buildQuery(params: BuildQueryParams) {
const { type, query, category, page = 1, perPage = 20 } = params;
const conditions = [`*[_type=="${type}"`];
if (query) conditions.push(`title match "*${query}*"`);
if (category && category !== "all") {
conditions.push(`category == "${category}"`);
}