Skip to content

Commit

Permalink
fix: rss search
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Nov 22, 2022
1 parent b2b563e commit 552f237
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/routes/[rss.xml].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ export async function loader({ request, context }: LoaderArgs) {
<channel>
<title>Remix Guide</title>
<description>A platform for the Remix community</description>
<link>https://remix.guide</link>
<link>${url.origin}</link>
<language>en-us</language>
<generator>remix-guide</generator>
<ttl>60</ttl>
<atom:link href="https://remix.guide/rss.xml" rel="self" type="application/rss+xml" />
<atom:link href="${
url.origin
}/rss.xml" rel="self" type="application/rss+xml" />
${entries
.map((entry) =>
`
Expand Down
6 changes: 4 additions & 2 deletions app/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ export function getSearchOptions(url: string): SearchOptions {
}

const { pathname, searchParams } = new URL(url, 'https://remix.guide');
const [list] = pathname.slice(1).split('/');
const options: SearchOptions = {
keyword: searchParams.get('q'),
author: searchParams.get('author'),
list: list === 'resources' ? searchParams.get('list') : list,
list:
pathname.startsWith('/resources') || pathname === '/rss.xml'
? searchParams.get('list')
: pathname.slice(1).split('/').shift(),
site: searchParams.get('site'),
category: searchParams.get('category'),
platform: searchParams.get('platform'),
Expand Down

0 comments on commit 552f237

Please sign in to comment.