fix: Merge in develop changes without re-introduced issues
There were some trouble the snuck in when mergin an earlier PR
This commit is contained in:
parent
c2882cce22
commit
d2b4d2d3b3
36 changed files with 2677 additions and 2470 deletions
|
@ -1,6 +1,11 @@
|
|||
import { localePath } from 'shared/utils.mjs'
|
||||
import { siteConfig as config } from 'site/site.config.mjs'
|
||||
|
||||
/**
|
||||
* get pre-generated paths for each language for post slug pages
|
||||
* @param {Object} posts an object holding all the posts
|
||||
* @return {String[]} paths for the most recent posts in all locales
|
||||
*/
|
||||
export const getPostSlugPaths = (posts) => {
|
||||
const paths = []
|
||||
|
||||
|
@ -15,6 +20,12 @@ export const getPostSlugPaths = (posts) => {
|
|||
return paths
|
||||
}
|
||||
|
||||
/**
|
||||
* get pre-generated paths for each language for post index pages
|
||||
* @param {Object} posts an object keyed by locale of posts sorted by date published
|
||||
* @param {String} type post type: blog, showcase, or newsletter
|
||||
* @return {String[]} paths for the first two pages of posts in all locales
|
||||
*/
|
||||
export const getPostIndexPaths = (posts, type) => {
|
||||
const paths = []
|
||||
for (const language in posts) {
|
||||
|
@ -25,6 +36,15 @@ export const getPostIndexPaths = (posts, type) => {
|
|||
return paths
|
||||
}
|
||||
|
||||
/**
|
||||
* get static props for a post index page
|
||||
* @param {Object} pagenr the current page number in the pagination
|
||||
* @param {Object} posts on object keyed by slug holding the posts title
|
||||
* @return {Object} meta on object keyed by slug holding the posts metadata
|
||||
* @return {Object[]} props.posts the posts to link to on the page
|
||||
* @return {Number} props.current the current page number
|
||||
* @return {Number} props.total the total number of pages
|
||||
*/
|
||||
export const getPostIndexProps = (pagenr, posts, meta) => {
|
||||
const pageNum = parseInt(pagenr)
|
||||
const numLocPages = Math.ceil(Object.keys(posts).length / config.posts.perPage)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue