Skip to content

Commit

Permalink
improvement: change yeartitle combined field formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinstadler committed Jan 6, 2025
1 parent 0272b58 commit 6857ea8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/[locale]/works/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function WorksPage(props: WorksPageProps) {
return item.label.startsWith(props.params.category);
})
.map((item) => {
const [year, title] = item.label.split("_");
const [_category, year, title] = item.label.split("_");
item.label = Number.isNaN(parseInt(year!)) ? title! : `${title!} (${year!})`;
return item;
});
Expand Down
3 changes: 2 additions & 1 deletion scripts/3_to_typesense.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ def del_empty_strings(o, field_names):
w["category"] = categories[w["category"]] if w["category"] else "fragments"

# helper field for the faceted listing by work
w["yeartitle"] = f'{w["category"]}${w["year"]}${w["short_title"]}'
# w["yeartitle"] = f'{w["category"]}_{w["year"]}_{w["short_title"].replace(" ", "_")}'
w["yeartitle"] = f'{w["category"]}_{w["year"]}_{w["short_title"]}'

for t in translations:
t["work"] = works[t["work"] - 1]
Expand Down

0 comments on commit 6857ea8

Please sign in to comment.