1. Ben Bangert
  2. tinkerer

Commits

Christian Jann  committed a54e5d4

Make the number of blog posts per page configurable

  • Participants
  • Parent commits ab5e3a0
  • Branches default

Comments (0)

Files changed (3)

File tinkerer/__templates/conf.py

View file
 # linked directly
 rss_service = None
 
+# Number of blog posts per page
+max_posts_per_page = 10
+
 # **************************************************************
 # Edit lines below to further customize Sphinx build
 # **************************************************************

File tinkerer/ext/aggregator.py

View file
     Generates aggregated pages.
     '''
     env = app.builder.env
+    max_posts = app.config.max_posts_per_page
 
     # get post groups
-    groups = [env.blog_posts[i:i+10] for i in range(0, len(env.blog_posts), 10)]
+    groups = [env.blog_posts[i:i+max_posts] for i in range(0, len(env.blog_posts), max_posts)]
 
     # for each group
     for i, posts in enumerate(groups):

File tinkerer/ext/blog.py

View file
     app.add_config_value("author", "Winston Smith", True)
     app.add_config_value("rss_service", None, True)
     app.add_config_value("website", "http://127.0.0.1/blog/html/", True)
-
+    app.add_config_value("max_posts_per_page", 10, True)
+    
     # new directives
     app.add_directive("author", author.AuthorDirective)
     app.add_directive("comments", metadata.CommentsDirective)