fix for static tag page generation
This commit is contained in:
parent
296ec378f3
commit
d27e330611
|
@ -186,8 +186,8 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
|||
const pageCount = Math.ceil(total / CMS.BLOG_RESULTS_PER_PAGE);
|
||||
const _paths = [];
|
||||
|
||||
for (let i = 1; i <= pageCount; i++) {
|
||||
_paths.push({ params: { slug: [tags[i], String(i)] } });
|
||||
for (let j = 1; j <= pageCount; j++) {
|
||||
_paths.push({ params: { slug: [tags[i], String(j)] } });
|
||||
}
|
||||
|
||||
paths.push(..._paths);
|
||||
|
|
|
@ -86,11 +86,15 @@ export class CmsApi {
|
|||
skip: (page - 1) * quantity,
|
||||
});
|
||||
|
||||
const results = await this.generateEntries(_entries, 'post');
|
||||
return {
|
||||
entries: results.entries as Array<IPost>,
|
||||
total: results.total,
|
||||
};
|
||||
if (_entries.items.length > 0) {
|
||||
const results = await this.generateEntries(_entries, 'post');
|
||||
return {
|
||||
entries: results.entries as Array<IPost>,
|
||||
total: results.total,
|
||||
};
|
||||
}
|
||||
|
||||
return Promise.reject(new Error(`Failed to fetch entries for ${tag}`));
|
||||
}
|
||||
|
||||
public async fetchBlogEntriesWithoutDevUpdates(
|
||||
|
|
Loading…
Reference in New Issue