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