Skip to content

Commit

Permalink
feat: include list name on rss item title
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Nov 22, 2022
1 parent 552f237 commit dcb86bb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/routes/[rss.xml].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { LoaderArgs } from '@remix-run/cloudflare';
import { capitalize } from '~/helpers';
import { search } from '~/resources';
import { getSearchOptions } from '~/search';

Expand All @@ -21,7 +22,12 @@ export async function loader({ request, context }: LoaderArgs) {
const entries = list.entries.reduce<FeedEntry[]>((list, resource) => {
if (resource.title) {
list.push({
title: resource.title,
title:
!searchOptions.list && resource.lists
? `[${resource.lists.map((list) => capitalize(list)).join(', ')}] ${
resource.title
}`
: resource.title,
pubDate: new Date(resource.createdAt).toUTCString(),
link: resource.url,
guid: `${url.origin}/resources/${resource.id}`,
Expand Down

0 comments on commit dcb86bb

Please sign in to comment.