Fix Local category page never showing Local-tagged sources
/category/local secretly filtered by geo:'philadelphia' instead of the Local category, a leftover from an old "Local: <region>" colon-syntax convention that has no admin UI behind it anymore — the Sources tab assigns plain category names via checkboxes, so a source tagged "Local" never got a matching geo value and could never show up here, even though it correctly appeared on Top Stories (which only checks pushToTopStories + the category array, not geo). Local now filters by category like every other category page. Verified: reproduced the exact bug (geo: null despite category: ['Local']), confirmed /api/feed?geo=philadelphia returns nothing while the new /api/feed?category=local correctly returns the article.
This commit is contained in:
@@ -3,10 +3,12 @@ import { getFeed } from '$lib/api';
|
|||||||
|
|
||||||
const PAGE_SIZE = 15;
|
const PAGE_SIZE = 15;
|
||||||
|
|
||||||
|
// Every category page (including "Local") filters by its category name — sources are
|
||||||
|
// assigned categories directly via checkboxes in the admin Sources tab, so a source
|
||||||
|
// tagged "Local" shows up here the same way one tagged "Tech" shows up on /category/tech.
|
||||||
export const load: PageLoad = async ({ params, fetch }) => {
|
export const load: PageLoad = async ({ params, fetch }) => {
|
||||||
const name = params.name;
|
const name = params.name;
|
||||||
const isLocal = name.toLowerCase() === 'local';
|
const filters = { category: name };
|
||||||
const filters = isLocal ? { geo: 'philadelphia' } : { category: name };
|
|
||||||
const initial = await getFeed({ ...filters, limit: PAGE_SIZE }, fetch);
|
const initial = await getFeed({ ...filters, limit: PAGE_SIZE }, fetch);
|
||||||
return { initial, filters, name, pageSize: PAGE_SIZE };
|
return { initial, filters, name, pageSize: PAGE_SIZE };
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user