summaryrefslogtreecommitdiffstats
path: root/_controllers/blog/__init__.py
blob: ae31be80e66c0350f5486024fa8ce7e3ec32fe56 (plain)
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
import logging

from blogofile.cache import bf

import archives
import categories
import chronological
import feed
import permapage
import post

config = {
        "name": "Blog",
        "description": "Creates a Blog",
        "priority": 90.0,

        #Posts
        "post.date_format": "%Y/%m/%d %H:%M:%S"
        }

def run():
    blog = bf.config.controllers.blog

    #Parse the posts
    blog.posts = post.parse_posts("_posts")
    blog.dir = bf.util.path_join(bf.writer.output_dir, blog.path)

    # Find all the categories and archives before we write any pages
    blog.archived_posts = {} ## "/archive/Year/Month" -> [post, post, ... ]
    blog.archive_links = []  ## [("/archive/2009/12", name, num_in_archive1), ...] (sorted in reverse by date)
    blog.categorized_posts = {} ## "Category Name" -> [post, post, ... ]
    blog.all_categories = [] ## [("Category 1",num_in_category_1), ...] (sorted alphabetically)
    archives.sort_into_archives()
    categories.sort_into_categories()

    blog.logger = logging.getLogger(config['name'])
    
    permapage.run()
    chronological.run()
    archives.run()
    categories.run()
    feed.run()