17 lines
368 B
TypeScript
17 lines
368 B
TypeScript
import { getArchiveTree } from '~~/lib/blog/read-posts';
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const query = getQuery(event);
|
|
const include = (content) => {
|
|
if (query.tag) {
|
|
if (!content.tags?.length || !content.tags.includes(query.tag)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
return getArchiveTree(include);
|
|
});
|