Skip to content

Commit

Permalink
feat(Next > Search): Add search support to gallery search keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
danactive committed Nov 5, 2023
1 parent 5377101 commit ad0d764
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions next/pages/[gallery].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ export const getStaticProps: GetStaticProps<ComponentProps, Params> = async (con
const { albums } = await getAlbums(params.gallery)
const preparedAlbums = albums.map((album): ServerSideAlbumItem => ({
...album,
corpus: [album.h1, album.h2, album.year].join(' '),
corpus: [album.h1, album.h2, album.year, album.search].join(' '),
}))
return {
props: { gallery: params.gallery, albums: preparedAlbums, ...indexKeywords(albums) },
props: { gallery: params.gallery, albums: preparedAlbums, ...indexKeywords(preparedAlbums) },
}
}

Expand Down
1 change: 1 addition & 0 deletions next/public/galleries/demo/gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<album_h2>British Columbia</album_h2> <!-- heading 2: State/Province -->
<year>2001-2005</year> <!-- Year outputted as text in gallery view -->
<filename>2004-01-04-01.jpg</filename> <!-- must start with a four letter year; file must be hosted in the media folder > year folder (i.e. media/2004/2004-01-04-01.jpg) -->
<search>2001, 2004, British Columbia</search>
</album>
</gallery>
1 change: 1 addition & 0 deletions public/galleries/demo/gallery.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
<album_h2>British Columbia</album_h2> <!-- heading 2: State/Province -->
<year>2001-2005</year> <!-- Year outputted as text in gallery view -->
<filename>2004-01-04-01.jpg</filename> <!-- must start with a four letter year; file must be hosted in the media folder > year folder (i.e. media/2004/2004-01-04-01.jpg) -->
<search>2001, 2004, British Columbia</search>
</album>
</gallery>

0 comments on commit ad0d764

Please sign in to comment.