From e8528296b00bcac109910a3ce1be796e779b34fa Mon Sep 17 00:00:00 2001 From: Zachary Vance Date: Fri, 2 Aug 2024 23:21:42 -0400 Subject: [PATCH] Switch to final absolute URLs --- blog | 13 +++++++------ config.yaml | 19 +++++++++++-------- static/{ => css}/style-wordpress.css | 0 static/{resources => }/images/RSS.png | Bin static/resources/images/Twitter.png | Bin 3360 -> 0 bytes templates/author.mustache.html | 2 +- templates/feed.mustache.html | 2 +- templates/layout.mustache.html | 11 ++++------- templates/post.mustache.html | 6 +++--- templates/tagcloud.mustache.html | 2 +- 10 files changed, 28 insertions(+), 27 deletions(-) rename static/{ => css}/style-wordpress.css (100%) rename static/{resources => }/images/RSS.png (100%) delete mode 100644 static/resources/images/Twitter.png diff --git a/blog b/blog index 92f2e5a..38d2a9f 100755 --- a/blog +++ b/blog @@ -179,7 +179,11 @@ class Templatable(PseudoMap): @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)] @@ -343,7 +347,7 @@ class Image(Templatable): class Blog(PseudoMap): def __init__(self, config="config.yaml", reload=False): - self.tags = {} + self.tags = {} # Tag -> str self.categories = {} self.authors = {} self._posts = [] @@ -366,6 +370,7 @@ class Blog(PseudoMap): 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): @@ -487,10 +492,6 @@ class Blog(PseudoMap): 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 = [ diff --git a/config.yaml b/config.yaml index 88d1a99..ea1ec32 100644 --- a/config.yaml +++ b/config.yaml @@ -1,9 +1,11 @@ # 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" @@ -13,26 +15,27 @@ static_dir: "static" 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" diff --git a/static/style-wordpress.css b/static/css/style-wordpress.css similarity index 100% rename from static/style-wordpress.css rename to static/css/style-wordpress.css diff --git a/static/resources/images/RSS.png b/static/images/RSS.png similarity index 100% rename from static/resources/images/RSS.png rename to static/images/RSS.png diff --git a/static/resources/images/Twitter.png b/static/resources/images/Twitter.png deleted file mode 100644 index 8e2d0aa0fc2dad3d5ad21a12432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4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0006@NklFUG5rt4QOkW4DCS&MFbbY*`*-j;HrOs;2?AtQXE8~ zlS9EFbd&Byw^~vuw9@<_HpE(Odl$LJT9dY>(TkV6bBR(kXD>@}=y!a7JfG)%-|zdr zkMMn;qmaZA=@@hj`mIQ(#&WqVfIeN<>p>Gu(;NaG16P4<;1Tc~=m!RLUC$r9IzcNs z1qdVBpV2MN!Vx zYPH>TI(;MT8SMhCSS&UikH?>uN~IU3Y2GwVv$x$p6ttzeTrM*Dzk z8;!z)9!Q_>Q}4PwPZ4x%IEX% zfDb_l1=;(&=XoPSh!G*gwL~KE*MLT&v27T}^62R3)avSL8CYr?fo?$WEz7zfgxHWI z>7}A5gQ}{Yux-1(v$L~pS(Y_FKmT@ea`FvO0ScX*c2J^IaUz5Okb$$nX`m0#00n3Q q`@mlN)vg8wKNwpaS3& -

Author Archives: {{ tag }}

+

Author Archives: {{ tag }}

{{# posts.first10 }} diff --git a/templates/feed.mustache.html b/templates/feed.mustache.html index 22b7ce5..7ab22f9 100644 --- a/templates/feed.mustache.html +++ b/templates/feed.mustache.html @@ -19,7 +19,7 @@ {{# posts.first10 }} {{title}} - {{web_root}}/post/{{id}}.html + {{url}} {{date_rfc822}} {{# categories }} diff --git a/templates/layout.mustache.html b/templates/layout.mustache.html index 1576180..85dfdeb 100644 --- a/templates/layout.mustache.html +++ b/templates/layout.mustache.html @@ -7,7 +7,7 @@ - + @@ -24,10 +24,7 @@
blog of zachary "za3k" vance
@@ -37,8 +34,8 @@ diff --git a/templates/post.mustache.html b/templates/post.mustache.html index f0a6f18..a6309d7 100644 --- a/templates/post.mustache.html +++ b/templates/post.mustache.html @@ -7,7 +7,7 @@