fix: sitemap last updated
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
e00a73b9c9
commit
a511f900dd
@ -1,6 +1,6 @@
|
||||
|
||||
import { createDirectus, readItems, rest } from '@directus/sdk';
|
||||
import { DIRECTUS_URL, mapAuthor, mapCategory, mapIndexPosts, mapPost } from './directusUtils';
|
||||
import { DIRECTUS_URL, mapAuthor, mapCategory, mapIndexPosts, mapPost, mapSitemapPosts } from './directusUtils';
|
||||
|
||||
const POSTS_PER_PAGE = 10;
|
||||
|
||||
@ -170,7 +170,7 @@ export const browseAllPost = async (page = 1) => {
|
||||
sort: ["-date_published"]
|
||||
}))
|
||||
|
||||
return posts.map(mapIndexPosts);
|
||||
return posts.map(mapSitemapPosts);
|
||||
}
|
||||
export const browsePostWithTag = async (slug: string, page = 1) => {
|
||||
const filterTag = {
|
||||
|
@ -56,6 +56,22 @@ export const mapIndexPosts = (post: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const mapSitemapPosts = (post: any) => {
|
||||
const author = mapPostAuthor(post.author);
|
||||
const category = mapPostCategory(post.category);
|
||||
|
||||
return {
|
||||
title: post.title,
|
||||
feature_image: generateAssetUrl(post.feature_image),
|
||||
authors: [author],
|
||||
category: category,
|
||||
excerpt: post.excerpt,
|
||||
date_published: post.date_published,
|
||||
date_updated: post.date_updated,
|
||||
reading_time: null,
|
||||
url: generatePostUrl(category?.slug, post.slug),
|
||||
}
|
||||
}
|
||||
export const mapAuthor = (author: any) => {
|
||||
if (author) {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user