2022-10-16 09:37:13 +00:00
|
|
|
import { getArchiveTree } from '~~/lib/blog/read-posts';
|
|
|
|
|
|
|
|
export default defineEventHandler(async (event) => {
|
2022-10-16 11:04:03 +00:00
|
|
|
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);
|
2022-10-16 09:37:13 +00:00
|
|
|
});
|