Introduce segments for blog posts and filter them

This commit is contained in:
Michal Vanko 2023-02-15 22:40:37 +01:00
parent f156d4dacc
commit dac3e13520
33 changed files with 84 additions and 11 deletions

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: How I've built my website title: How I've built my website
segments:
- blog
published: true published: true
date: 2020-02-28T16:00:55.791Z date: 2020-02-28T16:00:55.791Z
thumbnail: /images/uploads/DSC01202.jpg thumbnail: /images/uploads/DSC01202.jpg

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Custom Redox keyboard assembly title: Custom Redox keyboard assembly
segments:
- blog
published: true published: true
date: 2020-04-10T15:16:54.820Z date: 2020-04-10T15:16:54.820Z
thumbnail: /images/uploads/img_20200301_171735.jpg thumbnail: /images/uploads/img_20200301_171735.jpg

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Transition to Colemak keyboard layout title: Transition to Colemak keyboard layout
segments:
- blog
published: true published: true
date: 2020-05-11T05:38:18.797Z date: 2020-05-11T05:38:18.797Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Samsung Galaxy Buds+ Review title: Samsung Galaxy Buds+ Review
segments:
- blog
published: true published: true
date: 2020-06-07T22:58:18.797Z # TODO executable line for generating date date: 2020-06-07T22:58:18.797Z # TODO executable line for generating date
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: I've made an RSS feed title: I've made an RSS feed
segments:
- blog
published: true published: true
date: 2020-06-15T15:48:18.797Z # TODO executable line for generating date date: 2020-06-15T15:48:18.797Z # TODO executable line for generating date
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: WebAssembly briefing title: WebAssembly briefing
segments:
- blog
published: true published: true
date: 2020-08-05T15:38:18.797Z # TODO executable line for generating date date: 2020-08-05T15:38:18.797Z # TODO executable line for generating date
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: How to deal with technical debt title: How to deal with technical debt
segments:
- blog
published: true published: true
date: 2020-11-08T15:57:18.797Z date: 2020-11-08T15:57:18.797Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: I've moved my site to Netlify title: I've moved my site to Netlify
segments:
- blog
published: true published: true
date: 2020-11-20T20:35:05.230Z date: 2020-11-20T20:35:05.230Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Guide on error handling title: Guide on error handling
segments:
- blog
published: true published: true
date: 2020-12-09T14:44:11.948Z date: 2020-12-09T14:44:11.948Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Logging recommendations title: Logging recommendations
segments:
- blog
published: true published: true
date: 2020-12-18T14:39:53.533Z date: 2020-12-18T14:39:53.533Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Podcast episode about Agile development title: Podcast episode about Agile development
segments:
- blog
published: true published: true
date: 2021-02-16T09:09:57.102Z date: 2021-02-16T09:09:57.102Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Introduction to JavaScript Application testing title: Introduction to JavaScript Application testing
segments:
- blog
published: true published: true
date: 2021-05-07T14:44:57.102Z # update date accordingly date: 2021-05-07T14:44:57.102Z # update date accordingly
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: How we handle the rapid growth of the project team title: How we handle the rapid growth of the project team
segments:
- blog
published: true published: true
date: 2021-12-16T11:02:10.123Z date: 2021-12-16T11:02:10.123Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: First Weekly title: First Weekly
segments:
- blog
published: true published: true
date: 2022-02-06T17:13:02.611Z date: 2022-02-06T17:13:02.611Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "I've started streaming - Weekly #06-2022 " title: "I've started streaming - Weekly #06-2022 "
segments:
- blog
published: true published: true
date: 2022-02-13T19:39:33.578Z date: 2022-02-13T19:39:33.578Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "Laptop battery got fat - Weekly #07-2022" title: "Laptop battery got fat - Weekly #07-2022"
segments:
- blog
published: true published: true
date: 2022-02-20T17:50:56.214Z date: 2022-02-20T17:50:56.214Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Error handling with Either<Type> title: Error handling with Either<Type>
segments:
- blog
published: true published: true
date: 2022-02-28T11:30:54.195Z date: 2022-02-28T11:30:54.195Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "Second attempt @ Weekly #08-2022" title: "Second attempt @ Weekly #08-2022"
segments:
- blog
published: true published: true
date: 2022-02-28T11:49:53.914Z date: 2022-02-28T11:49:53.914Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "Coming from DevBreak - Weekly #11-2022" title: "Coming from DevBreak - Weekly #11-2022"
segments:
- blog
published: true published: true
date: 2022-03-19T21:22:35.128Z date: 2022-03-19T21:22:35.128Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "Happy Easter - Weekly #15-2022" title: "Happy Easter - Weekly #15-2022"
segments:
- blog
published: true published: true
date: 2022-04-17T08:05:05.489Z date: 2022-04-17T08:05:05.489Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: 'Treasure hunt - Weekly #18-2022' title: 'Treasure hunt - Weekly #18-2022'
segments:
- blog
published: true published: true
date: 2022-05-07T08:35:51.818Z date: 2022-05-07T08:35:51.818Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: "Our attempt at Rusty game jam - Weekly #25-2022" title: "Our attempt at Rusty game jam - Weekly #25-2022"
segments:
- blog
published: true published: true
date: 2022-06-26T20:02:47.419Z date: 2022-06-26T20:02:47.419Z
tags: tags:

View File

@ -1,6 +1,8 @@
--- ---
layout: blog layout: blog
title: Lovely London Trip title: Lovely London Trip
segments:
- blog
published: true published: true
date: 2022-11-27T19:49:09.204Z date: 2022-11-27T19:49:09.204Z
tags: tags:

View File

@ -1,6 +1,10 @@
--- ---
layout: blog layout: blog
title: dev - Ide to ? copy title: dev - Ide to ? copy
segments:
- blog
- broadcasts
- cookbook
published: true published: true
date: 2020-01-09T17:24:13.481Z date: 2020-01-09T17:24:13.481Z
thumbnail: /images/uploads/screenshot.gif thumbnail: /images/uploads/screenshot.gif

View File

@ -1,6 +1,10 @@
--- ---
layout: blog layout: blog
title: dev - Ide to ? title: dev - Ide to ?
segments:
- blog
- broadcasts
- cookbook
published: true published: true
date: 2019-08-09T17:24:13.481Z date: 2019-08-09T17:24:13.481Z
thumbnail: /images/uploads/screenshot.gif thumbnail: /images/uploads/screenshot.gif

View File

@ -1,6 +1,10 @@
--- ---
layout: blog layout: blog
title: dev - Anothert one title: dev - Anothert one
segments:
- blog
- broadcasts
- cookbook
published: true published: true
date: 2019-11-03T11:01:32.621Z date: 2019-11-03T11:01:32.621Z
thumbnail: /images/uploads/responzio.png thumbnail: /images/uploads/responzio.png

View File

@ -1,6 +1,10 @@
--- ---
layout: blog layout: blog
title: New Title title: New Title
segments:
- blog
- broadcasts
- cookbook
published: true published: true
date: 2020-05-11T05:38:18.797Z # TODO executable line for generating date date: 2020-05-11T05:38:18.797Z # TODO executable line for generating date
tags: tags:

View File

@ -52,6 +52,7 @@ export async function getBlogListing(paginationQuery: PaginationQuery) {
} }
}) })
) )
console.log(paginationQuery);
const filteredContents = pipe( const filteredContents = pipe(
sortBy<ArticleContent>(prop('date')), sortBy<ArticleContent>(prop('date')),
(items) => reverse(items), (items) => reverse(items),

View File

@ -34,6 +34,7 @@ export function filterAndCount<Item extends Record<string, any>>({
...dropTakeParams ...dropTakeParams
}: PaginationQuery) { }: PaginationQuery) {
return function (items: Item[]) { return function (items: Item[]) {
console.log(filters);
const filterFunction = filters const filterFunction = filters
? filterByPropContains<Item>(filters) ? filterByPropContains<Item>(filters)
: identity : identity

View File

@ -8,6 +8,7 @@ import type { RequestHandler } from './$types'
export const prerender = true export const prerender = true
export const GET = (async ({ params }) => { export const GET = (async ({ params }) => {
console.log(params);
const handledParams = params.params === 'index' ? '' : params.params const handledParams = params.params === 'index' ? '' : params.params
const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams) const { page = 1, pageSize = 7, ...filters } = parseParams(handledParams)
const paginationParams = getDropTakeFromPageParams( const paginationParams = getDropTakeFromPageParams(

View File

@ -6,9 +6,8 @@ import type { PaginationResult } from '$lib/pagination/pagination'
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const { page = 1, pageSize = 7, ...filters } = parseParams(params.params) const { page = 1, pageSize = 7, ...filters } = parseParams(params.params)
const articleResponse = await fetch( const articleResponse = await fetch(
`/articles/${params.params ? params.params : 'index'}.json` `/articles/segments/blog${params.params ? `/${params.params}` : ''}.json`
).then((r) => r.json()) ).then((r) => r.json())
return { return {
posts: articleResponse.posts as PaginationResult<ArticleContent>, posts: articleResponse.posts as PaginationResult<ArticleContent>,
page: Number(page), page: Number(page),

View File

@ -6,7 +6,7 @@ import type { PaginationResult } from '$lib/pagination/pagination'
export const load = (async ({ fetch, params }) => { export const load = (async ({ fetch, params }) => {
const { page = 1, pageSize = 7, ...filters } = parseParams(params.params) const { page = 1, pageSize = 7, ...filters } = parseParams(params.params)
const articleResponse = await fetch( const articleResponse = await fetch(
`/articles/${params.params ? params.params : 'index'}.json` `/articles/segments/broadcasts${params.params ? `/${params.params}` : ''}.json`
).then((r) => r.json()) ).then((r) => r.json())
return { return {

View File

@ -19,6 +19,15 @@ collections:
fields: # The fields for each document, usually in front matter fields: # The fields for each document, usually in front matter
- { label: 'Layout', name: 'layout', widget: 'hidden', default: 'blog' } - { label: 'Layout', name: 'layout', widget: 'hidden', default: 'blog' }
- { label: 'Title', name: 'title', widget: 'string' } - { label: 'Title', name: 'title', widget: 'string' }
- label: 'Segments'
name: 'segments'
widget: 'select'
multiple: true
options:
- { label: 'Blog', value: 'blog' }
- { label: 'Broadcasts', value: 'Broadcasts' }
- { label: 'Cookbook', value: 'cookbook' }
default: ['blog']
- { - {
label: 'Published', label: 'Published',
name: 'published', name: 'published',