diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-01 02:28:10 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-01 02:28:10 +0900 |
| commit | cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a (patch) | |
| tree | 0e00d7caf3031fa86decaa0cbc226cc1e521b914 /services/nuldoc/nuldoc-src/generators/post_list.ts | |
| parent | d08e3edb65b215152aa26e3518fb2f2cd7071c4b (diff) | |
| parent | 1964f77d03eb647dcf46d63dde68d7ae7301604f (diff) | |
| download | nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.tar.gz nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.tar.zst nsfisis.dev-cd16ed5d6b46d91ae9ac7b2237d6405ad6715a4a.zip | |
Merge branch 'feat/ruby-rewrite'
Diffstat (limited to 'services/nuldoc/nuldoc-src/generators/post_list.ts')
| -rw-r--r-- | services/nuldoc/nuldoc-src/generators/post_list.ts | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/services/nuldoc/nuldoc-src/generators/post_list.ts b/services/nuldoc/nuldoc-src/generators/post_list.ts deleted file mode 100644 index 3be4ec05..00000000 --- a/services/nuldoc/nuldoc-src/generators/post_list.ts +++ /dev/null @@ -1,56 +0,0 @@ -import PostListPage from "../pages/PostListPage.ts"; -import { Config } from "../config.ts"; -import { Page } from "../page.ts"; -import { PostPage } from "./post.ts"; - -export type PostListPage = Page; - -export async function generatePostListPages( - posts: PostPage[], - config: Config, -): Promise<PostListPage[]> { - const postsPerPage = config.sites.blog.postsPerPage; - const totalPages = Math.ceil(posts.length / postsPerPage); - const pages: PostListPage[] = []; - - for (let pageIndex = 0; pageIndex < totalPages; pageIndex++) { - const pagePosts = posts.slice( - pageIndex * postsPerPage, - (pageIndex + 1) * postsPerPage, - ); - - const page = await generatePostListPage( - pagePosts, - config, - pageIndex + 1, - totalPages, - ); - - pages.push(page); - } - - return pages; -} - -async function generatePostListPage( - posts: PostPage[], - config: Config, - currentPage: number, - totalPages: number, -): Promise<PostListPage> { - const html = await PostListPage(posts, config, currentPage, totalPages); - - const destFilePath = currentPage === 1 - ? "/posts/index.html" - : `/posts/${currentPage}/index.html`; - - const href = currentPage === 1 ? "/posts/" : `/posts/${currentPage}/`; - - return { - root: html, - renderer: "html", - site: "blog", - destFilePath, - href, - }; -} |
