<commit_before>class @BlogController extends RouteController
  action: ->
    if @ready()
      @render()
    else if Template['loading']
      @render 'loading'

Router.map ->

  #
  # RSS Feed
  #

  if Meteor.isServer
    @route 'rss',
      where: 'server'
      path: '/rss/posts'
      action: ->
        @response.write Meteor.call 'serveRSS'
        @response.end()

  #
  # Blog Index
  #

  @route 'blogIndex',
    path: '/blog'
    controller: 'BlogController'

    onBeforeAction: ->
      if Blog.settings.blogIndexTemplate
        @template = Blog.settings.blogIndexTemplate

      if not Session.get('postLimit') and Blog.settings.pageSize
        Session.set 'postLimit', Blog.settings.pageSize

    waitOn: -> [
      Meteor.subscribe 'posts', Session.get('postLimit')
      Meteor.subscribe 'authors'
    ]

    fastRender: true

    data: ->
      posts: Post.where
        published: true
      ,
        sort:
          publishedAt: -1

  #
  # Blog Tag
  #

  @route 'blogTagged',
    path: '/blog/tag/:tag'
    controller: 'BlogController'

    onBeforeAction: ->
      if Blog.settings.blogIndexTemplate
        @template = Blog.settings.blogIndexTemplate

      # Set up our own 'waitOn' here since IR does not atually wait on 'waitOn'
      # (see https://github.com/EventedMind/iron-router/issues/265).
      @subscribe('taggedPosts', @params.tag).wait()

    waitOn: -> [
      Meteor.subscribe 'taggedPosts', @params.tag
      Meteor.subscribe 'authors'
    ]

    fastRender: true

    data: ->
      posts: Post.where
        published: true
        tags: @params.tag
      ,
        sort:
          publishedAt: -1

  #
  # Show Blog<commit_msg>Don't use session to store pageLimit, breaks IR 0.7.1. Don't need it anyway.<commit_after>class @BlogController extends RouteController
  action: ->
    if @ready()
      @render()
    else if Template['loading']
      @render 'loading'

Router.map ->

  #
  # RSS Feed
  #

  if Meteor.isServer
    @route 'rss',
      where: 'server'
      path: '/rss/posts'
      action: ->
        @response.write Meteor.call 'serveRSS'
        @response.end()

  #
  # Blog Index
  #

  @route 'blogIndex',
    path: '/blog'
    controller: 'BlogController'

    onBeforeAction: ->
      if Blog.settings.blogIndexTemplate
        @template = Blog.settings.blogIndexTemplate

    waitOn: -> [
      Meteor.subscribe 'posts', Blog.settings.pageSize
      Meteor.subscribe 'authors'
    ]

    fastRender: true

    data: ->
      posts: Post.where
        published: true
      ,
        sort:
          publishedAt: -1

  #
  # Blog Tag
  #

  @route 'blogTagged',
    path: '/blog/tag/:tag'
    controller: 'BlogController'

    onBeforeAction: ->
      if Blog.settings.blogIndexTemplate
        @template = Blog.settings.blogIndexTemplate

    waitOn: -> [
      Meteor.subscribe 'taggedPosts', @params.tag
      Meteor.subscribe 'authors'
    ]

    fastRender: true

    data: ->
      posts: Post.where
        published: true
        tags: @params.tag
      ,
        sort:
          publishedAt: -1

  #
  # Show Blog
{'fraction_non_alphanumeric': 0.1171142025234552, 'fraction_numerical': 0.003235198964736331, 'mean_word_length': 2.082751744765703, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1299473', 'n_tokens_mistral': 1006, 'n_tokens_neox': 937, 'n_words': 219}