]> git.za3k.com Git - blog.git/commitdiff
Switch to final absolute URLs
authorZachary Vance <za3k@za3k.com>
Sat, 3 Aug 2024 03:21:42 +0000 (23:21 -0400)
committerZachary Vance <za3k@za3k.com>
Sat, 3 Aug 2024 03:21:42 +0000 (23:21 -0400)
blog
config.yaml
static/css/style-wordpress.css [moved from static/style-wordpress.css with 100% similarity]
static/images/RSS.png [moved from static/resources/images/RSS.png with 100% similarity]
static/resources/images/Twitter.png [deleted file]
templates/author.mustache.html
templates/feed.mustache.html
templates/layout.mustache.html
templates/post.mustache.html
templates/tagcloud.mustache.html

diff --git a/blog b/blog
index 92f2e5ad312ce465df60297e19734af546c4ef1f..38d2a9ff509583930f298722800a5cd3ef7813c3 100755 (executable)
--- 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 = [
index 88d1a993a020a88e6110e4989b4a41531c884fa1..ea1ec3297337d003eda3b22badece584e832ed8b 100644 (file)
@@ -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/resources/images/Twitter.png b/static/resources/images/Twitter.png
deleted file mode 100644 (file)
index 8e2d0aa..0000000
Binary files a/static/resources/images/Twitter.png and /dev/null differ
index ec6c32272a7680f644aa24c9329e30be6cce1bdf..c2b63f1798cc161b517984731976e0c8a2125072 100644 (file)
@@ -1,5 +1,5 @@
 <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 }}
index 22b7ce5d61d09d6c13b8171a53f13c9cfbc41693..7ab22f9d4f74e1287c27d8e3e8ba52a812c269a4 100644 (file)
@@ -19,7 +19,7 @@
     {{# 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 }}
index 1576180da10a221d1815e793b6c0fcc9a325e50c..85dfdeb99a235b028d5dea02dd602d897a72a54c 100644 (file)
@@ -7,7 +7,7 @@
     <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>
@@ -37,8 +34,8 @@
         <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>
index f0a6f183db6145368693a846f874784e37e697dd..a6309d78e65c4090c8c6d251442e6e4de1518204 100644 (file)
@@ -7,7 +7,7 @@
 </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>
 
index 9db1f351e1770084c1609da669b41b02e974e0d4..34de6f3699d7d8b9b40f49e48bb4b24911d9b829 100644 (file)
@@ -1,6 +1,6 @@
 
 <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>