Remove speech archive categories
This commit is contained in:
parent
1cce3ddc89
commit
e0a79bf5ef
2 changed files with 7 additions and 31 deletions
|
|
@ -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 – 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue