diff --git a/content/photos/2014-04-26-ai-weiwei-stools/index.md b/content/photos/2014-04-26-ai-weiwei-stools/index.md index f8fcecbf..812bb131 100644 --- a/content/photos/2014-04-26-ai-weiwei-stools/index.md +++ b/content/photos/2014-04-26-ai-weiwei-stools/index.md @@ -5,6 +5,7 @@ author: Matthias Kretschmann --- Ai Weiwei - Evidence, Stools at Martin Gropius Bau + Processed with VSCOcam with b2 preset [flickr](https://www.flickr.com/photos/krema/14016811365/) | [EyeEm](http://www.eyeem.com/p/35839008) diff --git a/content/photos/2021-11-26-forever-bicycles/index.md b/content/photos/2021-11-26-forever-bicycles/index.md index a09753c2..091264ee 100644 --- a/content/photos/2021-11-26-forever-bicycles/index.md +++ b/content/photos/2021-11-26-forever-bicycles/index.md @@ -1,7 +1,7 @@ --- date: 2021-11-26T15:32:28.000Z -title: Forever Bicycles +title: Ai Weiwei, Forever Bicycles image: ./2021-11-26-forever-bicycles.jpg --- diff --git a/content/photos/2021-11-26-law-of-the-journey/index.md b/content/photos/2021-11-26-law-of-the-journey/index.md index c86ffc75..fbe58743 100644 --- a/content/photos/2021-11-26-law-of-the-journey/index.md +++ b/content/photos/2021-11-26-law-of-the-journey/index.md @@ -1,7 +1,7 @@ --- date: 2021-11-26T16:12:03.000Z -title: Law of the Journey +title: Ai Weiwei, Law of the Journey image: ./2021-11-26-law-of-the-journey.jpg --- diff --git a/src/components/PhotoTeaser.astro b/src/components/PhotoTeaser.astro index f8f80649..6600f44e 100644 --- a/src/components/PhotoTeaser.astro +++ b/src/components/PhotoTeaser.astro @@ -9,35 +9,22 @@ const { title, image } = data --- -
- { - image ? ( - - - - ) : null - } -
+{ + image ? ( + + + + ) : null +} diff --git a/src/components/RelatedPosts/index.astro b/src/components/RelatedPosts/index.astro index 2f942640..5bf31902 100644 --- a/src/components/RelatedPosts/index.astro +++ b/src/components/RelatedPosts/index.astro @@ -12,45 +12,35 @@ type Props = { } const { post, isPhotos } = Astro.props as Props const allPosts = await getAllPostsForSearch() +const allPostsWithoutCurrent = allPosts?.filter( + (post) => post.slug !== Astro.props.post.slug +) as CollectionEntry<'articles' | 'photos' | 'links'>[] // Configure fuse.js // https://fusejs.io/api/options.html -const fuseOptions: Fuse.IFuseOptions< - CollectionEntry<'articles' | 'photos' | 'links'> -> = { - keys: ['data.tags', 'data.title', 'data.lead', 'collection'], +const fuse = new Fuse(allPostsWithoutCurrent, { + keys: ['data.tags', 'data.title', 'data.lead'], useExtendedSearch: true, - minMatchCharLength: 3, - threshold: 0.8 -} -// TODO; figure out how to remove any -const allPostsWithoutCurrent = allPosts?.filter( - (post) => post.slug !== Astro.props.post.slug -) -const fuse = new Fuse(allPostsWithoutCurrent as any, fuseOptions) + threshold: 0.6 +}) const relatedPosts = fuse // https://www.fusejs.io/examples.html#extended-search .search( - `${post?.data?.tags?.join(' | ')} | ${post?.data?.title} | ${ - (post?.data as any)?.lead - } | ${post?.collection}` + `${post?.data?.tags?.join(' | ')} | "${post?.data?.lead}" | "${ + post?.data?.title + }"` ) .map((result) => result.item) .slice(0, 6) --- -
-

- Related {isPhotos ? 'Photos' : 'Posts'}{' '} - -

+
+

Related