pass # TODO
class Blog(PseudoMap):
- def __init__(self, config="config.yaml"):
+ def __init__(self, config):
self.tags = {} # Tag -> str
self.categories = {}
self.authors = {}
@property
def static(self):
- for dirpath, dirnames, filenames in Path(self.static_dir).walk():
+ for dirpath, dirnames, filenames in os.walk(str(self.static_dir)):
for name in filenames:
- path = dirpath / name
+ path = Path(dirpath) / name
yield Static(path, self)
@property
)
parser.add_argument("-l", "--local", action='store_true', help="use relative paths for links")
parser.add_argument("-p", "--publish", action='store_true', help="publish to blog2.za3k.com")
+ parser.add_argument("-c", "--config", help="location of config file", default="config.yaml")
args = parser.parse_args()
- blog = Blog()
+ blog = Blog(config=args.config)
blog.local = args.local
if args.local:
blog.web_root = "file://" + blog.destination
--- /dev/null
+# These two properties are always first, and always absolute paths
+source: "/var/www/blog-src"
+destination: "/var/www/blog"
+
+web_root: "https://blog.za3k.com"
+title: 'blog of zachary "za3k" vance'
+# For search bar
+domain: "blog.za3k.com"
+posts_per_page: 10
+
+post_dir: "posts"
+comments_dir: "comments"
+page_dir: "page"
+image_dir: "images"
+static_dir: "static"
+
+author_template: "templates/author.mustache.html"
+category_template: "templates/category.mustache.html"
+index_template: "templates/index.mustache.html"
+feed_template: "templates/feed.mustache.html"
+layout_template: "templates/layout.mustache.html"
+pagination_template: "templates/pagination.mustache.html"
+post_template: "templates/post.mustache.html"
+tag_template: "templates/tag.mustache.html"
+tagcloud_template: "templates/tagcloud.mustache.html"
+
+# Non-local mode, preferred link address
+author_url: "{{web_root}}/author/{{slug}}/"
+author_paginated_url: "{{web_root}}/author/{{slug}}/{{page_num}}/"
+category_url: "{{web_root}}/category/{{slug}}/"
+category_paginated_url: "{{web_root}}/category/{{slug}}/{{page_num}}/"
+tag_url: "{{web_root}}/tag/{{slug}}/"
+tag_paginated_url: "{{web_root}}/tag/{{slug}}/{{page_num}}/"
+index_url: "{{web_root}}"
+index_paginated_url: "{{web_root}}/page/{{page_num}}"
+post_url: "{{web_root}}/{{id}}/"
+feed_url: "{{web_root}}/feed/"
+
+author_destination: "{{destination}}/author/{{slug}}.html"
+author_paginated_destination: "{{destination}}/author/{{slug}}.{{page_num}}.html"
+category_destination: "{{destination}}/category/{{slug}}.html"
+category_paginated_destination: "{{destination}}/category/{{slug}}.{{page_num}}.html"
+index_destination: "{{destination}}/page/index.html"
+index_paginated_destination: "{{destination}}/page/index.{{page_num}}.html"
+feed_destination: "{{destination}}/page/feed.xml"
+image_destination: "{{destination}}/images/{{image}}"
+page_destination: "{{destination}}/{{page}}"
+post_destination: "{{destination}}/posts/{{id}}.html"
+static_destination: "{{destination}}/{{relative_path}}"
+tag_destination: "{{destination}}/tag/{{slug}}.html"
+tag_paginated_destination: "{{destination}}/tag/{{slug}}.{{page_num}}.html"
+
+category_destination: "{{destination}}/category/{{slug}}.html"
+index_destination: "{{destination}}/page/index.html"
+tag_destination: "{{destination}}/tag/{{slug}}.html"