Remove speech archive categories #5

Merged
konradkunkel8 merged 1 commit from codex/remove-speech-categories into main 2026-06-11 17:48:13 +00:00
2 changed files with 7 additions and 31 deletions

View file

@ -30,7 +30,7 @@ body.custom-background { background-color: #ffffff; }
.speech-filters {
display: grid;
grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
grid-template-columns: minmax(240px, 2fr) repeat(2, minmax(150px, 1fr)) auto;
gap: 12px;
align-items: end;
margin: 0 0 18px;
@ -100,18 +100,16 @@ body.custom-background { background-color: #ffffff; }
}
.speech-result p {
margin: 0 0 10px;
margin: 0;
}
.speech-result-meta,
.speech-result-categories {
.speech-result-meta {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.speech-result-meta span,
.speech-result-categories span {
.speech-result-meta span {
display: inline-flex;
align-items: center;
min-height: 22px;

View file

@ -5,12 +5,11 @@ import { getSpeechArchive, uniqueSorted } from "../../lib/speeches";
const speeches = getSpeechArchive();
const years = uniqueSorted(speeches.map((speech) => speech.year), "desc");
const speakers = uniqueSorted(speeches.map((speech) => speech.speaker));
const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.length ? speech.categories : [speech.category]));
---
<SiteLayout
title="Speeches Archive &#8211; FFWPU Ireland"
description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, category, and text."
description="Search the FFWPU Ireland archive of speeches by Rev. Sun Myung Moon and Dr. Hak Ja Han Moon by year, speaker, and text."
bodyClass="page-template page-template-templates page-template-template-onecolumn page-template-templatestemplate-onecolumn-php page custom-background tribe-no-js metaslider-plugin parabola-image-three caption-light meta-light parabola_triagles parabola-menu-left"
pathname="/speeches/"
canonical="/speeches/"
@ -47,14 +46,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
</select>
</div>
<div class="speech-filter">
<label for="speech-category">Category</label>
<select id="speech-category" name="category">
<option value="">All categories</option>
{categories.map((category) => <option value={category}>{category}</option>)}
</select>
</div>
<button class="speech-reset" type="reset">Reset filters</button>
</form>
@ -74,9 +65,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
<a href={speech.url}>{speech.title}</a>
</h2>
<p>{speech.excerpt}</p>
<div class="speech-result-categories">
{(speech.categories.length ? speech.categories : [speech.category]).map((category) => <span>{category}</span>)}
</div>
</article>
))
}
@ -98,9 +86,8 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
const searchInput = document.getElementById("speech-search");
const yearSelect = document.getElementById("speech-year");
const speakerSelect = document.getElementById("speech-speaker");
const categorySelect = document.getElementById("speech-category");
if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect || !categorySelect) {
if (!form || !results || !count || !searchInput || !yearSelect || !speakerSelect) {
return;
}
@ -120,7 +107,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
q: searchInput.value.trim(),
year: yearSelect.value,
speaker: speakerSelect.value,
category: categorySelect.value,
};
}
@ -141,7 +127,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
searchInput.value = params.get("q") || "";
yearSelect.value = params.get("year") || "";
speakerSelect.value = params.get("speaker") || "";
categorySelect.value = params.get("category") || "";
}
function matchesSpeech(speech, filters) {
@ -151,9 +136,6 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
if (filters.speaker && speech.speaker !== filters.speaker) {
return false;
}
if (filters.category && !speech.categories.includes(filters.category) && speech.category !== filters.category) {
return false;
}
if (!filters.q) {
return true;
}
@ -188,11 +170,7 @@ const categories = uniqueSorted(speeches.flatMap((speech) => speech.categories.l
const excerpt = document.createElement("p");
excerpt.textContent = speech.excerpt;
const categories = document.createElement("div");
categories.className = "speech-result-categories";
appendMeta(categories, speech.categories.length ? speech.categories : [speech.category]);
article.append(meta, title, excerpt, categories);
article.append(meta, title, excerpt);
return article;
}