@property
def url(self):
- return self.blog.web_root + "/" + str(self.output_path.relative_to(Path(self.blog.destination)))
+ url_template = self.blog["{}_url".format(self.type)]
+ if url_template is None:
+ return self.blog.web_root + "/" + str(self.output_path.relative_to(Path(self.blog.destination)))
+ else:
+ return mustache.render(url_template, self.context)
def render_template(source, blog, name, context, replace_links=True):
template_path = blog["{}_template".format(name)]
class Blog(PseudoMap):
def __init__(self, config="config.yaml", reload=False):
- self.tags = {}
+ self.tags = {} # Tag -> str
self.categories = {}
self.authors = {}
self._posts = []
if k.endswith("_dir") or k.endswith("_template") or k.endswith("_path"):
v = os.path.join(self.source, os.path.expanduser(v))
self[k] = v
+ self.feed_url = mustache.render(self.feed_url, self)
@property
def deadlinks(self):
return Templatable.render_template(Templatable, blog, "tagcloud", self)
- @property
- def feed_url(self):
- return Page("feed", self, use_layout=False).url
-
def _update_happened(self, path):
path = Path(path)
reload_update = [
# These two properties are always first, and always absolute paths
source: "/home/zachary/blog"
destination: "/home/zachary/blog/public"
+
web_root: "https://blog2.za3k.com"
-domain: "blog2.za3k.com"
title: 'blog of zachary "za3k" vance'
+# For search bar
+domain: "blog2.za3k.com"
post_dir: "posts"
comments_dir: "comments"
author_template: "templates/author.mustache.html"
category_template: "templates/category.mustache.html"
-deadlinks_template: "templates/deadlinks.mustache.html"
-links_template: "templates/links.mustache.html"
index_template: "templates/index.mustache.html"
feed_template: "templates/feed.mustache.html"
layout_template: "templates/layout.mustache.html"
post_template: "templates/post.mustache.html"
-postcombined_template: "templates/postcombined.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}}/"
+category_url: "{{web_root}}/category/{{slug}}/"
+tag_url: "{{web_root}}/tag/{{slug}}/"
+index_url: "{{web_root}}"
+post_url: "{{web_root}}/{{id}}/"
+feed_url: "{{web_root}}/feed/"
+
author_destination: "{{destination}}/author/{{slug}}.html"
category_destination: "{{destination}}/category/{{slug}}.html"
-deadlinks_destination: "{{destination}}/page/deadlinks.html"
-links_destination: "{{destination}}/page/links.html"
index_destination: "{{destination}}/page/index.html"
feed_destination: "{{destination}}/page/feed.xml"
image_destination: "{{destination}}/images/{{image}}"
page_destination: "{{destination}}/{{page}}"
post_destination: "{{destination}}/posts/{{id}}.html"
-post_md_destination: "{{destination}}/posts/{{id}}.md.html"
-post_html_destination: "{{destination}}/posts/{{id}}.orig.html"
static_destination: "{{destination}}/{{relative_path}}"
tag_destination: "{{destination}}/tag/{{slug}}.html"
<header class="page-header">
- <h1 class="page-title author">Author Archives: <span class="vcard"><a class="url fn n" href="https://blog.za3k.com/author/{{ slug }}/" title="admin" rel="me">{{ tag }}</a></span></h1>
+ <h1 class="page-title author">Author Archives: <span class="vcard"><a class="url fn n" href="{{ url }}/" title="admin" rel="me">{{ tag }}</a></span></h1>
</header>
{{# posts.first10 }}
{{# posts.first10 }}
<item>
<title>{{title}}</title>
- <link>{{web_root}}/post/{{id}}.html</link>
+ <link>{{url}}</link>
<dc:creator><![CDATA[{{author.tag}}]]></dc:creator>
<pubDate>{{date_rfc822}}</pubDate>
{{# categories }}
<meta name="robots" content="max-image-preview:large">
<link rel="alternate" type="application/rss+xml" title=" ยป Feed" href="{{feed_url}}">
- <link rel="stylesheet" href="{{web_root}}/style-wordpress.css" type="text/css" media="all">
+ <link rel="stylesheet" href="{{web_root}}/css/style-wordpress.css" type="text/css" media="all">
</head>
<body>
<div id="site-description">blog of zachary "za3k" vance</div>
<div class="socials" id="sheader">
<a target="_blank" rel="nofollow" href="{{feed_url}}" class="socialicons social-RSS" title="RSS">
- <img alt="RSS" src="{{web_root}}/resources/images/RSS.png">
- </a>
- <a target="_blank" rel="nofollow" href="https://twitter.com/unchoke" class="socialicons social-Twitter" title="Twitter">
- <img alt="Twitter" src="{{web_root}}/resources/images/Twitter.png">
+ <img alt="RSS" src="{{web_root}}/images/RSS.png">
</a>
</div>
</div>
<nav id="access" class="" role="navigation">
<div class="menu">
<ul id="prime_nav" class="menu">
- <li id="menu-item-255" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-255"><a href="{{web_root}}/category/non-technical.html">Non-Technical</a></li>
- <li id="menu-item-256" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-256"><a href="{{web_root}}/category/technical.html">Technical</a></li>
+ <li id="menu-item-255" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-255"><a href="{{web_root}}/category/non-technical/">Non-Technical</a></li>
+ <li id="menu-item-256" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-256"><a href="{{web_root}}/category/technical/">Technical</a></li>
</ul>
</div>
</nav>
</h1>
<div class="entry-meta">
-<span class="author vcard"> By <a class="url fn n" href="{{web_root}}/author/{{author.slug}}.html" rel="author" title="View all posts by {{author.tag}}">{{author.tag}}</a> <span class="bl_sep">|</span></span> <time class="onDate date published" datetime="{{date}}"> <a href="{{url}}" rel="bookmark" title="{{time}}"><span class="entry-date">{{day}}</span> <span class="entry-time"> - {{time}}</span></a> </time><span class="bl_sep">|</span><time class="updated" datetime="{{date}}">{{day}}</time>
+<span class="author vcard"> By <a class="url fn n" href="{{author.url}}" rel="author" title="View all posts by {{author.tag}}">{{author.tag}}</a> <span class="bl_sep">|</span></span> <time class="onDate date published" datetime="{{date}}"> <a href="{{url}}" rel="bookmark" title="{{time}}"><span class="entry-date">{{day}}</span> <span class="entry-time"> - {{time}}</span></a> </time><span class="bl_sep">|</span><time class="updated" datetime="{{date}}">{{day}}</time>
{{#has_categories}}
<span class="bl_categ">
<div class="entry-utility">
{{#has_tags}}
<span class="bl_posted">Tagged
- {{# tags_list }}<a href="{{web_root}}/tag/{{thing.slug}}.html" rel="tag">{{thing.tag}}</a>{{^last}}, {{/last}}{{/ tags_list }}{{#main_display}}.{{/main_display}}
+ {{# tags_list }}<a href="{{thing.url}}" rel="tag">{{thing.tag}}</a>{{^last}}, {{/last}}{{/ tags_list }}{{#main_display}}.{{/main_display}}
</span>
{{/has_tags}}
{{#main_display}}
-<span class="bl_bookmark"> Bookmark the <a href="{{url}}" rel="bookmark" title="Permalink to {{title}}"> permalink</a>.</span>
+<span class="bl_bookmark"> Bookmark the <a href="{{url}}" rel="bookmark" title="Permalink to {{title}}"> permalink</a>.</span>
{{/main_display}}
</div>
<p class="wp-block-tag-cloud">
{{# top_tags }}
- <a href="../tag/{{ slug }}.html" class="tag-cloud-link" style="font-size: {{ font_size }}pt;" aria-label="{{ tag }} ({{ num_posts }} items)">{{ tag }}</a>
+ <a href="{{ url }}" class="tag-cloud-link" style="font-size: {{ font_size }}pt;" aria-label="{{ tag }} ({{ num_posts }} items)">{{ tag }}</a>
{{/ top_tags }}
</p>