code: def find_new_posts_and_pages(db):
      Q = Query()
      for root, dirs, files in os.walk(CONFIG['content_root']):
          for filename in sorted([f for f in files if
                                 f.endswith(('md', 'markdown'))]):
              fullpath = os.path.join(root, filename)
              _p = fullpath.split(CONFIG['content_root'])[-1].lstrip('/')
              new_mtime = int(os.path.getmtime(fullpath))
              e, item = None, None
              for collection in ['posts', 'pages']:
                  item = db[collection].get(Q.filename == _p)
                  if item:
                      if new_mtime > item['mtime']:
                          db[collection].update({'mtime': new_mtime},
                                                doc_ids=[item.doc_id])
                          e = Entry(fullpath, doc_id=item.doc_id)
                      break
              if not item:
                  e = Entry(fullpath)
              if e:
                  yield e, e.id