コード例 #1
0
    def build_archives(self):
        pager = Pager(self._posts, self._config.archives_page_size)
        total_pages = pager.get_total_pages()

        for current_page, current_list in pager:
            _, local_path = self._router.gen("archives", "", current_page)
            local_path += "index.html"

            template = self._env.get_template("archives.html")
            output = template.render(content_list=current_list,
                                     current_page=current_page,
                                     max_pages=total_pages)
            safe_write(local_path, output)
コード例 #2
0
    def build_tags(self):
        for tag in self._tags:
            posts = self._posts.re_group(group_by_tagname(tag))

            pager = Pager(posts, self._config.archives_page_size)
            total_pages = pager.get_total_pages()

            for current_page, current_list in pager:
                _, local_path = self._router.gen("tag", tag, current_page)
                local_path += "index.html"

                template = self._env.get_template("tags.html")
                output = template.render(tag_name=tag,
                                         content_list=current_list,
                                         current_page=current_page,
                                         max_pages=total_pages)
                safe_write(local_path, output)
コード例 #3
0
    def build_categories(self):
        for category in self._categories:
            posts = self._posts.re_group(group_by_category(category))

            pager = Pager(posts, self._config.archives_page_size)
            total_pages = pager.get_total_pages()

            for current_page, current_list in pager:
                _, local_path = self._router.gen("category", category,
                                                 current_page)
                local_path += "index.html"

                template = self._env.get_template("categories.html")
                output = template.render(cate_name=category,
                                         content_list=current_list,
                                         current_page=current_page,
                                         max_pages=total_pages)
                safe_write(local_path, output)