refactor: remove unused Taxonomy type

This commit is contained in:
Scott
2024-04-28 16:55:11 -04:00
parent c3b327c4ee
commit d61da4c086

View File

@@ -1,7 +1,7 @@
import type { PaginateFunction } from 'astro';
import { getCollection } from 'astro:content';
import type { CollectionEntry } from 'astro:content';
import type { Post, Taxonomy } from '~/types';
import type { Post } from '~/types';
import { APP_BLOG } from 'astrowind:config';
import { cleanSlug, trimSlash, BLOG_BASE, POST_PERMALINK_PATTERN, CATEGORY_BASE, TAG_BASE } from './permalinks';
@@ -243,7 +243,7 @@ export const getStaticPathsBlogTag = async ({ paginate }: { paginate: PaginateFu
/** */
export async function getRelatedPosts(originalPost: Post, maxResults: number = 4): Promise<Post[]> {
const allPosts = await fetchPosts();
const originalTagsSet = new Set(originalPost.tags ? originalPost.tags.map(tag => tag.slug) : []);
const originalTagsSet = new Set(originalPost.tags ? originalPost.tags.map((tag) => tag.slug) : []);
const postsWithScores = allPosts.reduce((acc: { post: Post; score: number }[], iteratedPost: Post) => {
if (iteratedPost.slug === originalPost.slug) return acc;
@@ -254,7 +254,7 @@ export async function getRelatedPosts(originalPost: Post, maxResults: number = 4
}
if (iteratedPost.tags) {
iteratedPost.tags.forEach(tag => {
iteratedPost.tags.forEach((tag) => {
if (originalTagsSet.has(tag.slug)) {
score += 1;
}