def blog_document(document, url, blog="main", dtime=None):
    if not dtime: dtime = datetime.now()
    blog_file = gsettings.LOCAL_REPO_PATH.joinpath(
        "blogs"
    ).joinpath(blog).joinpath("%04d" % dtime.year).joinpath(
        "%02d" % dtime.month
    ).joinpath(dtime.day % "%02d.lst")
    if not blog_file.parent.exists(): 
        blog_file.parent.makedirs()
    blog_file.open("a+").write(
        "%s %s %s\n" % (url, document.name, str(dtime))
    )
    document.meta.url = url
    document.meta.save()
    for label in document.meta.get("labels", []):
        gsettings.LOCAL_REPO_PATH.joinpath(
            "blogs/%s/labels/%s.lst" % (blog, label)
        ).open("a+").write("%s\n" % url)
# }}}
dataset/ETHPy150Open amitu/gitology/src/gitology/blog.py/blog_document/swapped operands of `%`