1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
import GlobalFooter from "../components/GlobalFooter.ts";
import GlobalHeader from "../components/BlogGlobalHeader.ts";
import PageLayout from "../components/PageLayout.ts";
import Pagination from "../components/Pagination.ts";
import PostPageEntry from "../components/PostPageEntry.ts";
import { Config } from "../config.ts";
import { PostPage } from "../generators/post.ts";
import { elem, Element } from "../dom.ts";
export default async function PostListPage(
posts: PostPage[],
config: Config,
currentPage: number,
totalPages: number,
): Promise<Element> {
const pageTitle = "投稿一覧";
const pageInfoSuffix = ` (${currentPage}ページ目)`;
const metaTitle =
`${pageTitle}${pageInfoSuffix}|${config.sites.blog.siteName}`;
const metaDescription = `投稿した記事の一覧${pageInfoSuffix}`;
return await PageLayout({
metaCopyrightYear: config.site.copyrightYear,
metaDescription,
metaTitle,
metaAtomFeedHref: `https://${config.sites.blog.fqdn}/posts/atom.xml`,
site: "blog",
config,
children: elem(
"body",
{ class: "list" },
GlobalHeader({ config }),
elem(
"main",
{ class: "main" },
elem(
"header",
{ class: "page-header" },
elem("h1", {}, pageTitle + pageInfoSuffix),
),
Pagination({ currentPage, totalPages, basePath: "/posts/" }),
...posts.map((post) => PostPageEntry({ post, config })),
Pagination({ currentPage, totalPages, basePath: "/posts/" }),
),
GlobalFooter({ config }),
),
});
}
|