<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet href="/rss.xsl" type="text/xsl" ?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Gemini | Bacardi55&#39;s Web Cave</title>
    <link>https://bacardi55.io/tags/gemini/</link>
    <description>Recent content in Gemini on Bacardi55&#39;s Web Cave</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <managingEditor>bac@rdi55.pl (bacardi55)</managingEditor>
    <webMaster>bac@rdi55.pl (bacardi55)</webMaster>
    <copyright>2010-2025 bacardi55</copyright>
    <lastBuildDate>Tue, 13 May 2025 20:07:25 +0200</lastBuildDate>
    <atom:link href="https://bacardi55.io/tags/gemini/index.xml" rel="self" type="application/rss+xml" />
    <item>
      
      
        
      <title>2025-05-13 20:07</title><link>https://bacardi55.io/notes/20250513-2007/</link><pubDate>Tue, 13 May 2025 20:07:25 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/notes/20250513-2007/</guid><description>&lt;p&gt;I really like that I can now write one microblog entry and decide to deploy it on both or either my website (as &lt;a href=&#34;https://bacardi55.io/notes/&#34;&gt;notes&lt;/a&gt;) and/or on my capsule as a &lt;a href=&#34;gemini://gmi.bacardi55.io/tinylog.gmi&#34;&gt;tinylog entry&lt;/a&gt;!&#xA;I need to write more about this, but basically it goes like this:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;write in emacs/orgmode the entry using a capture template to preformat the entry (specially the frontmatter)&lt;/li&gt;&#xA;&lt;li&gt;Indicate in the frontmatter the channel: &amp;ldquo;tinylog&amp;rdquo; and / or &amp;ldquo;website&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;Optionnaly add a element to indicate it is a response to someone (used only on tinylog entry for now)&lt;/li&gt;&#xA;&lt;li&gt;Optionnaly add tags (only used on my website so far)&lt;/li&gt;&#xA;&lt;li&gt;Export to markdown using ox-hugo as for blog or gemlog post in the right place&lt;/li&gt;&#xA;&lt;li&gt;Git add / commit / push the file&lt;/li&gt;&#xA;&lt;li&gt;Sourcehut automated build starts like usual and use a new tool I created called &lt;a href=&#34;https://git.sr.ht/~bacardi55/micrologs&#34;&gt;micrologs&lt;/a&gt; to create the tinylog.gmi file and the different markdown file for hugo&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Seems over engineered like the rest of my deployment workflow, but weirdly I find it easy and fun :).&lt;/p&gt;&#xA;&lt;p&gt;Missing pieces:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Micro logging from my phone&lt;/li&gt;&#xA;&lt;li&gt;Add &amp;ldquo;fediverse&amp;rdquo; (my gotosocial account) as another channel to choose to deploy entries too&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;</description></item>
    <item>
      
      <title>Moving all my content to a dedicated repo</title><link>https://bacardi55.io/2025/04/23/moving-all-my-content-to-a-dedicated-repo/</link><pubDate>Wed, 23 Apr 2025 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2025/04/23/moving-all-my-content-to-a-dedicated-repo/</guid><description>&lt;p&gt;Today, I decided to over-complicate my deployment workflow… again! Or maybe simplified it… I am not sure 🤣…&lt;/p&gt;&#xA;&lt;p&gt;Anyway, in a nutshell, what I did is removed content from my blog and capsule repository and instead have one content repository instead.&lt;/p&gt;&#xA;&lt;p&gt;Previously, I had:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;a blog repository, containing all hugo (static site generator) related files (template, config, …) as well as the blog posts within &lt;code&gt;content/posts/&lt;/code&gt; and other content in there too (eg: pages, …)&lt;/li&gt;&#xA;&lt;li&gt;a capsule repository, containing all kiln (static capsule generator) related files and the gemlog posts. Similar to the blog one but for my capsule&lt;/li&gt;&#xA;&lt;li&gt;a writting-deployments (with the misspelling yes) repository, containing all the scripts needed to build and deploy both my website and capsule&lt;/li&gt;&#xA;&lt;li&gt;a repository for my custom hugo theme&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The issue were that I had content scattered across both the website and capsule repository. That was a bit annoying and then scripts were taking some content from the blog repository (blog posts) to convert them in gemtext (see &lt;a href=&#34;https://bacardi55.io/2025/04/02/from-hugo-markdown-to-gemtext-with-lowdown/&#34;&gt;here&lt;/a&gt;) and then take gemlog post from the capsule repo to put them (after some alteration) to my blog.&lt;/p&gt;&#xA;&lt;p&gt;While this hasn&amp;rsquo;t fundamentally changed, what I wanted to do is to regroup all content that were supposed to be used both in website and capsule in a single repository.&lt;/p&gt;&#xA;&lt;p&gt;I did this for 3 reasons:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;In the (very near) future, I want to move my micro blogging content to my website and/or capsule first and then syndicate elsewhere. I&amp;rsquo;ll write more about the general idea later, but I want a way to write microblog entries and decide easily where they will be displayed. Having this &amp;ldquo;content only repo&amp;rdquo; will help, but I&amp;rsquo;ll explicit the concept later, when I have it ready. A POC is well underway though :).&lt;/li&gt;&#xA;&lt;li&gt;It bugged me to have them separated (well, I could have live with it but it was still in my mind)&lt;/li&gt;&#xA;&lt;li&gt;Simplify the deployment process. While it doesn&amp;rsquo;t seem obvious when explaining all this, it made it simpler. If interested, the new script is &lt;a href=&#34;https://git.sr.ht/~bacardi55/writting-deploy/tree/main/item/import_content.sh&#34;&gt;here&lt;/a&gt; and the &lt;a href=&#34;https://git.sr.ht/~bacardi55/writting-deploy/tree/main/item/.build.yml&#34;&gt;.build file is there&lt;/a&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;From the writing-content repository, the steps are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;copy blog post to &lt;code&gt;content/posts/&lt;/code&gt; of the hugo directory&lt;/li&gt;&#xA;&lt;li&gt;copy gemlog posts to &lt;code&gt;content/gemlog/&lt;/code&gt; of the hugo directory, rename them from .gmi to .md, keep the frontmatter and remove the content from them&lt;/li&gt;&#xA;&lt;li&gt;copy gemlog posts to &lt;code&gt;content/gemlog/&lt;/code&gt; of the capsule directory&lt;/li&gt;&#xA;&lt;li&gt;copy blog posts to &lt;code&gt;content/blog/&lt;/code&gt; of the capsule directory after transforming them from markdown to gemtext (using &lt;code&gt;lowdown&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I&amp;rsquo;m also going to change the gemlog format from now on and add them in markdown instead of gemini. As you may have guessed, I&amp;rsquo;ll use lowdown to transform them in my script, same way I&amp;rsquo;m transforming my blog post to gemtext.&lt;/p&gt;&#xA;&lt;p&gt;Anyway, this post has been written a bit fast compared to others, but I was happy that I made that big change just in a couple of hours :-).&lt;/p&gt;&#xA;&lt;p&gt;There will be a couple of additional post to this series and hopefully that will be the end of it and this process will stay as is for a long period of time without any further changes :).&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>From hugo markdown to gemtext with lowdown</title><link>https://bacardi55.io/2025/04/02/from-hugo-markdown-to-gemtext-with-lowdown/</link><pubDate>Wed, 02 Apr 2025 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2025/04/02/from-hugo-markdown-to-gemtext-with-lowdown/</guid><description>&lt;p&gt;I&amp;rsquo;m still working on deploying again my blog to &lt;a href=&#34;https://geminiprotocol.net/&#34;&gt;gemini&lt;/a&gt;, and now that I can &lt;a href=&#34;https://bacardi55.io/2025/03/31/export-gemini-links-from-orgmode-to-markdown/&#34;&gt;export gemini links from orgmode to markdown&lt;/a&gt;, it was time for the next step(s). I decided years ago to &lt;a href=&#34;https://git.sr.ht/~adnano/kiln&#34;&gt;kiln&lt;/a&gt;, a simple capsule generator, because it was simple yet close enough to my ways of working with Hugo for my website. The important points are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Content is in gemtext with a &lt;a href=&#34;https://gohugo.io/content-management/front-matter/&#34;&gt;frontmatter header&lt;/a&gt;, like in hugo&lt;/li&gt;&#xA;&lt;li&gt;Output is customized via template files&lt;/li&gt;&#xA;&lt;li&gt;URL pattern are configurable (important for later)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;For the past year, I searched multiple times the best way to convert markdown to gemtext (or even html to gemtext). The best I found was &lt;a href=&#34;https://github.com/makew0rld/md2gemini&#34;&gt;md2gemini (by makew0rld)&lt;/a&gt; but I had some issues with it. Also, it didn&amp;rsquo;t took into consideration the frontmatter format so it was breaking more than expected. I could have removed the frontmatter content, run the script, and then copied the frontmatter content at the top of the generated output, or edited the tool, but never had the motivation to do last year.&lt;/p&gt;&#xA;&lt;p&gt;Then, doing another random search recently, I stumbled on a lost reddit page that mention &lt;a href=&#34;https://kristaps.bsd.lv/lowdown/&#34;&gt;lowdown&lt;/a&gt;… And my brain exploded with happiness (well maybe not, but i was happy after some quick tests)! Lowdown is a great tool to transform markdown files in different format. It can export it to html5, roff, man, latex… and gemtext! And it works with frontmatter content too! Going to write a bit more about lowdown later, but the tldr; is: it is an awesome tool to export markdown in another format like gemtext while using data from the frontmatter header :-).&lt;/p&gt;&#xA;&lt;p&gt;The main issue I had with lowdown was that it can only parse frontmatter content in the yaml format. Hugo accept frontmatter data in multiple format, yaml of course, but others too like toml. And of course at this stage I was exporting my orgmode post to markdown with the frontmatter data in the toml format (the default used by &lt;a href=&#34;https://ox-hugo.scripter.co/&#34;&gt;ox-hugo&lt;/a&gt;)…&lt;/p&gt;&#xA;&lt;p&gt;Well, step one was to change the frontmatter format from toml to yaml, which was as easy as adding a configuration line at the top of my orgmode file:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-orgmode&#34; data-lang=&#34;orgmode&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#+HUGO_FRONT_MATTER_FORMAT&lt;/span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;: yaml&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then I had to re-export every posts, which was a bit painful but easy.&lt;/p&gt;&#xA;&lt;p&gt;So at this point, I had markdown files (as before) but with yaml formated frontmatter, which changes nothing to Hugo to generate my blog. But is the first step towards generating gemtext that kiln will use.&lt;/p&gt;&#xA;&lt;p&gt;Second steps was to actually convert those markdown files to gemtext. As said, I used lowdown. Lowdown allows to use a template file to generate the desired output. Again, I&amp;rsquo;ll write more about this great CLI tool later, but in a nutshell, I created the following template (called &lt;code&gt;lowdown_gemtext.tpl&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-gotempl&#34; data-lang=&#34;gotempl&#34;&gt;---&#xA;title: $title$&#xA;date: $meta(date)$&#xA;params:&#xA;  categories: $categories$&#xA;  tags: $tags$&#xA;---&#xA;&#xA;$body$&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Using this template, it will generate the gemtext file with the frontmatter parameters I want to keep from the markdown files and then the body. That is an improvement from my previous way of doing things as I was loosing the categories and tags data (more on that later), but not anymore!&lt;/p&gt;&#xA;&lt;p&gt;Then, to transform a markdown file into a gemtext one, I used the following command:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lowdown -t gemini --gemini-link-noref --template ./lowdown_gemtext.tpl markdown_file.md &amp;gt; gemtext_file.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;-t gemini&lt;/code&gt; indicates that the markdown content is exported in gemtext&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--gemini-link-noref&lt;/code&gt; add links without reference, as i didn&amp;rsquo;t like to see [a], [b], … in the middle of my paragraphs being referenced after. Using this option, it just show the links below each paragraph as just links without title, which I find better than just letters or numbers&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;--template /path/to/template&lt;/code&gt; indicate the template file to use&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;markdown_file.md&lt;/code&gt; is the file to transform&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;gemtext_file.gmi&lt;/code&gt; is the destination file.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;And it worked great!… Well almost great :D. There was one remaining problem: images.&lt;/p&gt;&#xA;&lt;p&gt;When I add an image within my orgmode post, ox-hugo will generate something like that in the exported markdown:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-markdown&#34; data-lang=&#34;markdown&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;{ {&amp;lt; figure src=&amp;#34;/images/posts/2025/01/poll.png&amp;#34; caption=&amp;#34;&amp;lt;span class=\&amp;#34;figure-number\&amp;#34;&amp;gt;Figure 1: &amp;lt;/span&amp;gt;Image showing a fediverse poll about web pages vs external apps. 47% preferred \&amp;#34;always or usually brower\&amp;#34; vs 53% preferred \&amp;#34;always or usually separate program\&amp;#34;&amp;#34; &amp;gt;} }&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;(without the spaces between the curly brackets, but that was being interpreted by hugo…)&lt;/p&gt;&#xA;&lt;p&gt;Lowdown don&amp;rsquo;t do anything to this (as it should, it isn&amp;rsquo;t anything markdown related) and keeps it as is. Of course, that is not valid gemtext… Instead, I wanted something like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-gemtext&#34; data-lang=&#34;gemtext&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;/path/to/image/poll.png&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;What to do then? Use one of the greatest thing in programming: regexp &amp;lt;3. I used sed after the lowdown command to rewrite this content to the appropriate gemtext format:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;lowdown -t gemini --gemini-link-noref --template ./lowdown_gemtext.tpl markdown_file.md &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  | sed -E &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;s/\{\{&amp;lt; figure src=”\/images\/posts([^”]*)”.*&amp;gt;\}\}/=&amp;gt; \/blog\1/g&amp;#39;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;  &amp;gt; gemtext_file.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And voilà, the gemtext was now correct.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ll write some additional details around automating all of this in the part 3 of my &lt;a href=&#34;https://bacardi55.io/series/unnecessary-complex-deployment-workflow/&#34;&gt;series about my &amp;ldquo;unncessary complex deployment workflow&amp;rdquo;&lt;/a&gt;, a series started a year ago to fully automate my writing deployments that was eagerly waiting for the last part about the automation of my capsule deployment. Now with this step completed, I&amp;rsquo;m finally getting there.&lt;/p&gt;&#xA;&lt;p&gt;For the impatient people, the gist of the deployment is easy once you&amp;rsquo;ve read the &lt;a href=&#34;https://bacardi55.io/2024/03/26/unnecessary-complex-deployment-workflow-context-and-ideas/&#34;&gt;part 1&lt;/a&gt; and &lt;a href=&#34;https://bacardi55.io/2024/07/04/unnecessary-complex-deployment-workflow-blog-deployment/&#34;&gt;2&lt;/a&gt;. In the build file, there is &lt;code&gt;build_capsule.sh&lt;/code&gt; file that needs to:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;generate blog posts gemtext from markdown&lt;/li&gt;&#xA;&lt;li&gt;copy blog posts images from the hugo directory to kiln directory&lt;/li&gt;&#xA;&lt;li&gt;build with kiln&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Using kiln configuration, I used the same URL for posts in the web and gemini, which means that links for blog posts will now be in the form of &lt;code&gt;/&amp;lt;year&amp;gt;/&amp;lt;month&amp;gt;/&amp;lt;day&amp;gt;/&amp;lt;title&amp;gt;/&lt;/code&gt; and not &lt;code&gt;/blog/&amp;lt;year&amp;gt;/&amp;lt;month&amp;gt;/&amp;lt;day&amp;gt;/&amp;lt;title&amp;gt;/&lt;/code&gt; as it used to be. It may break some search engine results pages for some time but should not be a big problem in the long run. By doing so, I fixed easily all internal links from one blog posts to another in the gemini format, so worth it :-).&lt;/p&gt;&#xA;&lt;p&gt;There are still some issues remaining in the gemini version of my blog, but I consider those minors. I&amp;rsquo;ll work on it after finishing automating its deployment as they are not blockers (to me at least). But more on that later in a dedicated post about bringing back my blog to gemini!&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>Export gemini links from orgmode to markdown</title><link>https://bacardi55.io/2025/03/31/export-gemini-links-from-orgmode-to-markdown/</link><pubDate>Mon, 31 Mar 2025 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2025/03/31/export-gemini-links-from-orgmode-to-markdown/</guid><description>&lt;p&gt;Today, finally a short post (for real) as oppose to my usual lengthy posts!&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m currently working on deploying again my blog as a gemini capsule (if you don&amp;rsquo;t know what the gemini protocol is, &lt;a href=&#34;https://geminiquickst.art/&#34;&gt;read about it here&lt;/a&gt;) as I haven&amp;rsquo;t deployed any update to my gemini capsules for more than a year. While doing so, I had an issue when exporting my posts writen in org mode to markdown: each &lt;code&gt;gemini://&lt;/code&gt; link where ignore and removed in the exported file.&lt;/p&gt;&#xA;&lt;p&gt;For example, a link in org mode like &lt;code&gt;[[gemini://gmi.bacardi55.io][My capsule]]&lt;/code&gt; was exported as &lt;code&gt;[My capsule]()&lt;/code&gt; in markdown. Which of course was an issue as I didn&amp;rsquo;t want to fix the generated markdown manually…&lt;/p&gt;&#xA;&lt;p&gt;The solution, as usual, was clearly explained in the &lt;a href=&#34;https://orgmode.org/manual/&#34;&gt;orgmode manual&lt;/a&gt;: I needed to &lt;a href=&#34;https://orgmode.org/manual/Adding-Hyperlink-Types.html&#34;&gt;add an hyperlink type and tell emacs how to export it&lt;/a&gt;. When you add a new hyperlink type, you can tell emacs how to store, open and/or export those links. As I was lazy, I just configure how to export those links in different format.&lt;/p&gt;&#xA;&lt;p&gt;To do so, I added the following elisp code, 100% inspired from the above documentation page:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-elisp&#34; data-lang=&#34;elisp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (defun org-geminilinks-export (link description &lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; _)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Export a gemini link from Org files.&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (let ((path (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gemini:%s&amp;#34;&lt;/span&gt; link)) &lt;span style=&#34;color:#75715e&#34;&gt;;; %s contains the 2 starting slash&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        (desc (or description link)))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    (pcase &lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;html (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;lt;a target=\&amp;#34;_blank\&amp;#34; href=\&amp;#34;%s\&amp;#34;&amp;gt;%s&amp;lt;/a&amp;gt;&amp;#34;&lt;/span&gt; path desc))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;latex (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;\\href{%s}{%s}&amp;#34;&lt;/span&gt; path desc))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;texinfo (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;@uref{%s,%s}&amp;#34;&lt;/span&gt; path desc))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;ascii (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%s (%s)&amp;#34;&lt;/span&gt; desc path))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#f92672&#34;&gt;`&lt;/span&gt;md (&lt;span style=&#34;color:#a6e22e&#34;&gt;format&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;[%s](%s)&amp;#34;&lt;/span&gt; desc path))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      (&lt;span style=&#34;color:#66d9ef&#34;&gt;t&lt;/span&gt; path))))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  (org-link-set-parameters &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gemini&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                           :export &lt;span style=&#34;color:#a6e22e&#34;&gt;#&amp;#39;&lt;/span&gt;org-geminilinks-export)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If, like me, you are using doom emacs, add the above quote within an &lt;code&gt;after! ox&lt;/code&gt; command:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-elisp&#34; data-lang=&#34;elisp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;(after! ox&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  [code from above]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  )&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Next step is to define how to store and open those links, but for now it will do as I want to focus on the new pipeline to build and deploy my capsule that has been in a staled phase for far too long.&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>Unnecessary Complex Deployment Workflow: Blog Deployment</title><link>https://bacardi55.io/2024/07/04/unnecessary-complex-deployment-workflow-blog-deployment/</link><pubDate>Thu, 04 Jul 2024 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2024/07/04/unnecessary-complex-deployment-workflow-blog-deployment/</guid><description>&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;Nota: This is a post written before my &lt;a href=&#34;https://bacardi55.io/2024/05/31/facing-my-digital-worse-nightmare/&#34;&gt;data loss&lt;/a&gt;, but I still had a copy saved via syncthing on my phone. I tried to update it with lastest changes but some things (like scripts or build file) may have evolved since. Check the git repositories just in case.&lt;/p&gt;&#xA;&lt;p&gt;In the previous post of &lt;a href=&#34;https://bacardi55.io/series/unnecessary-complex-deployment-workflow/&#34;&gt;this series of post&lt;/a&gt;, I &lt;a href=&#34;https://bacardi55.io/2024/03/26/unnecessary-complex-deployment-workflow-context-and-ideas/&#34;&gt;explained the context, constraints and overall solution&lt;/a&gt; to deploy my blog and gemini capsule. This second post is about the initial setup and the specific steps to build and deploy this blog. The 3rd post will be about the capsule deployment. If you haven&amp;rsquo;t yet, I suggest you read at least the solution overview paragraph of the previous post.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution-details&#34;&gt;Solution details&lt;/h2&gt;&#xA;&lt;p&gt;As describe in the previous post, the main steps are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Pushing code to sourcehut git repository&lt;/li&gt;&#xA;&lt;li&gt;An automated build process starts to build both the web and capsule artifacts&lt;/li&gt;&#xA;&lt;li&gt;Once the artifacts are ready, send a message to a ntfy topic&lt;/li&gt;&#xA;&lt;li&gt;Web server subscribe to this ntfy topic and download and copy files when it receive a message&lt;/li&gt;&#xA;&lt;li&gt;Web server send a message to a ntfy topic to alert me that all is done&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;That is the global idea. So now let&amp;rsquo;s configure all this!&lt;/p&gt;&#xA;&lt;h2 id=&#34;configuration&#34;&gt;Configuration&lt;/h2&gt;&#xA;&lt;h3 id=&#34;sourcehut-git-repositories-configuration&#34;&gt;Sourcehut Git Repositories configuration&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start with &lt;a href=&#34;https://sr.ht&#34;&gt;SourceHut&lt;/a&gt;, where my git repository are hosted and where the build process will run.&lt;/p&gt;&#xA;&lt;p&gt;On SourceHut, I have a &lt;a href=&#34;https://sr.ht/~bacardi55/writings/sources&#34;&gt;Writings&lt;/a&gt; project containing 4 git repos:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://git.sr.ht/~bacardi55/website&#34;&gt;website&lt;/a&gt;: contains the hugo files and markdown content for generating the site.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://git.sr.ht/~bacardi55/capsule&#34;&gt;capsule&lt;/a&gt;: contains the kiln files and gemtext content for generating the capsule and blog links (without their content).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://git.sr.ht/~bacardi55/writting-deploy&#34;&gt;Deploy&lt;/a&gt; (unlisted / hidden from the list): contains the script files&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://git.sr.ht/~bacardi55/MinIndie&#34;&gt;MinIndie&lt;/a&gt;: My hugo theme manage independently&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;To start a build automatically after a git push, you need to have its manifest at the root of the said repo, in a file named &lt;code&gt;.build.yml&lt;/code&gt;. I have the same &lt;code&gt;.build.yml&lt;/code&gt; in my website and capsule repo. If I push something in either, the build will start.&#xA;I&amp;rsquo;m using a slightly different &lt;code&gt;.build.yml&lt;/code&gt; within the deploy repository, as it will simply run the pipeline without deployment and alert me via email of the result. Deployments happen only for changes within the capsule or website repository.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m using an archlinux as the based image of the CI to leverage &lt;a href=&#34;https://aur.archlinux.org/&#34;&gt;AUR packages&lt;/a&gt; and thus easily installed tools usually not in official repos like kiln, ntfysh or python-aiolinkding (a python library to interact with linkding API).&lt;/p&gt;&#xA;&lt;p&gt;The build manifest will load the 4 mentioned repositories and use them to generate 2 artifacts: &lt;code&gt;website.tgz&lt;/code&gt; and &lt;code&gt;capsule.tgz&lt;/code&gt;, containing respectively the public files of this website and the one for the gemini capsule (even though the capsule isn&amp;rsquo;t complete at this stage and doesn&amp;rsquo;t use yet this workflow).&lt;/p&gt;&#xA;&lt;p&gt;To generate &lt;a href=&#34;https://bacardi55.io/bookmarks/&#34;&gt;bookmarks&lt;/a&gt;, the scripts load linkding related secrets (API Token and Instance URL) via the sourcehut secrets management system. &lt;code&gt;set +x&lt;/code&gt; and &lt;code&gt;set -x&lt;/code&gt; are used to hide secrets from the build output. Ntfy configuration is loaded using secrets too, as well as the name of the topic to use.&lt;/p&gt;&#xA;&lt;p&gt;Gemlog files are retrieved from the capsule git repository and then transformed as required. This mean changing the extension and only keeping the frontmatter area, not the content.&lt;/p&gt;&#xA;&lt;p&gt;The complete &lt;code&gt;.build.yml&lt;/code&gt; file look like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;image&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;archlinux&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;packages&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;hugo&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;go&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;scdoc&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;make&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;python&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;python-aiolinkding&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;kiln-git&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;ntfysh-bin&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;python-pygal&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;python-cairosvg&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;sources&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;https://git.sr.ht/~bacardi55/website&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;https://git.sr.ht/~bacardi55/capsule&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;https://git.sr.ht/~bacardi55/writting-deploy&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;https://git.sr.ht/~bacardi55/MinIndie&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;secrets&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;addbd283-3e0a-40dd-ad27-093ae07963df&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# linkding url and api token&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;9e2057e3-8f8f-4e6c-91e2-0236fc4a7e18&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# ntfy token&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#ae81ff&#34;&gt;d552a5b3-3f7d-48c0-a2bb-15669c63a014&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# ntfy topic&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;tasks&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;setup&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      mkdir ~/website/themes/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cp -r ~/MinIndie ~/website/themes/minindie&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;bookmarks&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      set +x&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      . ~/.linkding_secrets&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      set -x&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/writting-deploy/ &amp;amp;&amp;amp; ./build_bookmarks.sh&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;content&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/writting-deploy/ &amp;amp;&amp;amp; ./import_gemlog_to_blog.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      #cd ~/writting-deploy/ &amp;amp;&amp;amp; ./import_blog_to_gemlog.sh&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;stats&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/writting-deploy/ &amp;amp;&amp;amp; ./generate_content_stats.sh&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;build&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/writting-deploy/ &amp;amp;&amp;amp; ./build_blog.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/writting-deploy/ &amp;amp;&amp;amp; ./build_capsule.sh&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;deploy&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      mkdir ~/artifacts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/website/ &amp;amp;&amp;amp; tar czf ~/artifacts/website.tgz ./public/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      cd ~/capsule/ &amp;amp;&amp;amp; tar czf ~/artifacts/capsule.tgz ./public/&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;ntfy&lt;/span&gt;: |&lt;span style=&#34;color:#e6db74&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      set +x&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      . ~/.ntfy_topic&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      /usr/bin/ntfy publish -c ~/.ntfy_secrets  --title=&amp;#34;JOB_ID: ${JOB_ID}&amp;#34; &amp;#34;${NTFY_TOPIC}&amp;#34; &amp;#34;New successful build: ${JOB_ID} -- Job URL: ${JOB_URL}&amp;#34; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;      set -x&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;artifacts&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;artifacts/website.tgz&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;artifacts/capsule.tgz&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;triggers&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;action&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;email&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;condition&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;failure&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;to&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;&amp;lt;email@example.com&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The different build tasks are:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;setup&lt;/code&gt;: Will put the &lt;code&gt;MinIndie&lt;/code&gt; theme within the &lt;code&gt;theme&lt;/code&gt; folder of the hugo directory&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;bookmarks&lt;/code&gt;: Load Linkding secrets and generate bookmarks markdown files via the &lt;code&gt;build_bookmarks.sh&lt;/code&gt; script (see below)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;content&lt;/code&gt;: Copy (and adapt) gemlog entries to the blog (see below). Copy (and adapt) blog entries within gemlog (will be detailed in the 3rd post of this series)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;stats&lt;/code&gt;: Generate &lt;a href=&#34;https://bacardi55.io/pages/stats/&#34;&gt;content statistics&lt;/a&gt;, you can &lt;a href=&#34;https://bacardi55.io/2024/03/07/generating-basic-content-statistics-for-static-site-generator/&#34;&gt;read more about it&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;build&lt;/code&gt;: Generate blog public files via &lt;code&gt;build_blog.sh&lt;/code&gt; (see below) and the capsule public files via &lt;code&gt;build_capsule.sh&lt;/code&gt; (detailed in 3rd post)&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;deploy&lt;/code&gt;: Create both &lt;code&gt;website.tgz&lt;/code&gt; and &lt;code&gt;capsule.tgz&lt;/code&gt; archive files&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;ntfy&lt;/code&gt;: Send message to relevant topic with JOB_ID.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Regarding &lt;code&gt;triggers&lt;/code&gt;, it will send an email only if a build fails. I don&amp;rsquo;t want an email if the build is successful as I should received notification via &lt;code&gt;ntfy&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The &lt;code&gt;artifacts&lt;/code&gt; section tells Sourcehut to keep the generated artifact (for 90 days) so the web (and gemini) server(s) can download them afterwards.&lt;/p&gt;&#xA;&lt;h3 id=&#34;build-scripts&#34;&gt;Build scripts&lt;/h3&gt;&#xA;&lt;p&gt;All the following scripts are available in the &lt;a href=&#34;https://git.sr.ht/~bacardi55/writting-deploy&#34;&gt;Deploy&lt;/a&gt; repo.&lt;/p&gt;&#xA;&lt;h4 id=&#34;dirconfig-dot-sh&#34;&gt;dirconfig.sh&lt;/h4&gt;&#xA;&lt;p&gt;All the following bash scripts rely on this one that contains directories configuration (so I can have a different one locally). The content of the &lt;code&gt;dirconfig.sh&lt;/code&gt; file is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Main directories&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;temp&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/_tmpdir&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blog&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/website&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;capsule&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/capsule&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;export_bookmarks_script&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/writting-deploy/shared-bookmarks-to-md.py&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;generate_stats_script&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/writting-deploy/generate_content_stats_graph.py&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Subdirectories&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## Blog:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blog_content&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;content&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blog_public&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;public&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blog_bookmarks&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;content/bookmarks&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;blog_gemlog&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;content/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;## Capsule:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;capsule_public&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;public&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;capsule_gemlog&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;content/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Stats related directory&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stats_export_dir&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/website/data&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stats_export_images&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/build/website/static/images/pages/stats/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stats_filename&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;content_stats.json&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;stats_content_types&lt;span style=&#34;color:#f92672&#34;&gt;=(&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;posts&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gemlog&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bookmarks&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;build-bookmarks-dot-sh&#34;&gt;build_bookmarks.sh&lt;/h4&gt;&#xA;&lt;p&gt;Simplified, the goal of this script is to start a python script (&lt;code&gt;shared-bookmarks-to-md.py&lt;/code&gt;) that will do all the work to import bookmarks. Content of the &lt;code&gt;build_bookmarks.sh&lt;/code&gt; file:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;source ./dirconfig.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Starting bookmark export to markdown&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Creating temp directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Going to bookmarks directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_bookmarks:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_bookmarks&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp ./_index.md &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/bookmark_index.md&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -f ./*.md&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/bin/python &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;export_bookmarks_script:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/bookmark_index.md&amp;#34;&lt;/span&gt; ./_index.md &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Cleaning temp dir &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Bookmarks files generated successfully&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;shared-bookmarks-to-md-dot-py&#34;&gt;shared-bookmarks-to-md.py&lt;/h4&gt;&#xA;&lt;p&gt;This script will retrieve all shared bookmarks via Linkding API and will generate markdown files for each in the right folder (&lt;code&gt;content/bookmarks/&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;/!\&lt;/strong&gt; Script written quickly and with an obvious problem if the number of bookmarks exceed 5555. Indeed, I need to manage pagination in API responses, but was lazy for this first version. The script as of the day of writing is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; asyncio&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; os&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; datetime &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; datetime&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; aiolinkding &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; async_get_client&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;async&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() &lt;span style=&#34;color:#f92672&#34;&gt;-&amp;gt;&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;None&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    linkding_url &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    linkding_api_token &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;try&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        linkding_url &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; os&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;environ[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;LINKDING_URL&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        linkding_api_token &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; os&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;environ[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;LINKDING_API_TOKEN&amp;#34;&lt;/span&gt;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;except&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Incorrect Linkding Configuration&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        exit()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    client &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; async_get_client(linkding_url, linkding_api_token)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Get all bookmarks:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# TODO: Manage &amp;#34;next&amp;#34; links in case there are more results than requested.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    bookmarks &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;await&lt;/span&gt; client&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;bookmarks&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;async_get_all(limit&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;5555&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; bookmark &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; bookmarks[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;results&amp;#39;&lt;/span&gt;]:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;is_archived&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;or&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;not&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;shared&amp;#34;&lt;/span&gt;]:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#66d9ef&#34;&gt;continue&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;+++&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title = &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;title&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;author = [&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Bacardi55&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;]) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        t &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; datetime&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;strptime(bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;date_added&amp;#34;&lt;/span&gt;], &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%Y-%m-&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%d&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;T%H:%M:%S.&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%f&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;Z&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;strftime(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;%Y-%m-&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%d&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;date = &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; str(t) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tag_names&amp;#34;&lt;/span&gt;]:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tags = [&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;, &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;join(bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;tag_names&amp;#34;&lt;/span&gt;]) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;]&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;bookmark_url = &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;url&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;description = &lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;description&amp;#34;&lt;/span&gt;]&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;replace(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;&amp;#34;&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#39;&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\&amp;#34;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;+++&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;if&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;notes&amp;#34;&lt;/span&gt;]:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            fm &lt;span style=&#34;color:#f92672&#34;&gt;+=&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Personal notes:&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;notes&amp;#34;&lt;/span&gt;] &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;\n&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        filename &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; str(bookmark[&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;id&amp;#34;&lt;/span&gt;]) &lt;span style=&#34;color:#f92672&#34;&gt;+&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;.md&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;with&lt;/span&gt; open(filename, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;w&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; write_file:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            write_file&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;write(fm)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;asyncio&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;run(main())&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;import-gemlog-to-blog&#34;&gt;import_gemlog_to_blog&lt;/h4&gt;&#xA;&lt;p&gt;This script import gemlog entries (in gemtext with a &lt;code&gt;.gmi&lt;/code&gt; extension) into markdown and remove their content, keeping only the frontmatter header. This is because I don&amp;rsquo;t want the content of my gemlog to be available anywhere on my blog.&lt;/p&gt;&#xA;&lt;p&gt;The script is as follow:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;source ./dirconfig.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Start importing gemlog article in website&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Creating temp directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Copying &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_index.md file in temporary directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_index.md&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog_index.md&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Removing gemlog folder:&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Copying gemlog entries from capsule repository: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;capsule:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;capsule_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp -r &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;capsule:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;capsule_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Going into gemlog directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Removing content after frontmatter in all gemlog .gmi files:&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sed -i &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;1,/---/!d&amp;#39;&lt;/span&gt; ./*.gmi &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Renaming all .gmi files into .md in &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;:&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; file in ./*.gmi; &lt;span style=&#34;color:#66d9ef&#34;&gt;do&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  mv -- &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$file&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;file%.gmi&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;.md&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;done&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Copying back the gemlog _index.md file&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog_index.md&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_gemlog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_index.md&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Cleaning temp dir &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;generate-content-stats-dot-sh-and-generate-content-stats-graph-dot-py&#34;&gt;generate_content_stats.sh and generate_content_stats_graph.py&lt;/h4&gt;&#xA;&lt;p&gt;These scripts will generate the data and images for the &lt;a href=&#34;https://bacardi55.io/pages/stats&#34;&gt;content statitics page&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I wrote at length about it in a &lt;a href=&#34;https://bacardi55.io/2024/03/07/generating-basic-content-statistics-for-static-site-generator/&#34;&gt;dedicated blog post&lt;/a&gt;, so read it if you want as I won&amp;rsquo;t re-detailed everything.&lt;/p&gt;&#xA;&lt;h4 id=&#34;build-blog-dot-sh&#34;&gt;build_blog.sh&lt;/h4&gt;&#xA;&lt;p&gt;This script basically generate public files via the &lt;code&gt;hugo&lt;/code&gt; command and a few other minor stuff:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;source ./dirconfig.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Start building blog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Going to blog directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Creating temp directory: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Removing old public files in &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -fr &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Generate outputs&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Generating public directory…&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;hugo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# To keep old RSS filename.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Duplicating index.xml to rss.xml for backward compatibility.&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/index.xml&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/rss.xml&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Because I don&amp;#39;t want the gemlog files to be available at all on the blog (https):&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# But before, save the gemlog index and atom feed files:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Saving gemlog atom feed: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.xml&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.xml&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_gemlog_atom.xml&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Saving gemlog index.html: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.html&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.html&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_gemlog_index.html&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Deleting gemini html files: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Copy back the atom feed:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Reinstalling gemlog atom feed:&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_gemlog_atom.xml&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.xml&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cp &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/_gemlog_index.html&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;blog_public&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/index.html&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Cleaning temp dir &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;temp:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blog built successfully&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;ntfy-configuration&#34;&gt;Ntfy configuration&lt;/h3&gt;&#xA;&lt;p&gt;For the rest of this post, let&amp;rsquo;s decide that:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;topic-deployment&lt;/code&gt; is the name of the ntfy topic used by sourcehut to indicate a new build was successful&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;topic-updated&lt;/code&gt; is the name of the ntfy topic used by my webserver to indicate the update has been published&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Adapt accordingly :).&lt;/p&gt;&#xA;&lt;p&gt;Also, I&amp;rsquo;m not covering the ntfy installation process here as I already had that working. I&amp;rsquo;m just going to detail the configuration I went through.&lt;/p&gt;&#xA;&lt;h4 id=&#34;create-ntfy-users&#34;&gt;Create ntfy users&lt;/h4&gt;&#xA;&lt;p&gt;Create sourcehut ntfy user: only able to write on &lt;code&gt;topic-deployment&lt;/code&gt; channel:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy user add --role&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;user sourcehut&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy access sourcehut topic-deployment wo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy token add sourcehut&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Create a zoro (name of my webserver) ntfy user: only able to read &lt;code&gt;topic-deployment&lt;/code&gt; channel and able to write only to &lt;code&gt;topic-updated&lt;/code&gt; channel:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy user add --role&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;user zoro&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy access zoro topic-deployment ro&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy access zoro topic-updated wo&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sudo ntfy token add zoro&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h4 id=&#34;install-and-configure-ntfy-on-the-web-server&#34;&gt;Install and configure ntfy on the web server&lt;/h4&gt;&#xA;&lt;!--list-separator--&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;On SourceHut&lt;/p&gt;&#xA;&lt;p&gt;As I&amp;rsquo;m using an archlinux image, installation is done via adding the package to the &lt;code&gt;.build.yml&lt;/code&gt; file. I also used sourcehut secrets to upload a file with my ntfy configuration that contains only these 2 lines:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;default-host&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://example.com&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;default-token&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;yourTokenHere&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Use here the token generated above for sourcehut.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;!--list-separator--&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;On the web server&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://docs.ntfy.sh/install/&#34;&gt;Install ntfy&lt;/a&gt; package depending on your distro and configure &lt;code&gt;/etc/ntfy/client.yml&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;default-host&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;https://domain.tld&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;default-token&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;mytoken&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# ZORO TOKEN&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;subscribe&lt;/span&gt;:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;  - &lt;span style=&#34;color:#f92672&#34;&gt;topic&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;topic-deployment&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;command&lt;/span&gt;: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;export NTFY_UPDATE_TOPIC=&amp;#34;topic-updates&amp;#34;; /path/to/update_blog.sh $t&amp;#39;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;token&lt;/span&gt;: &lt;span style=&#34;color:#ae81ff&#34;&gt;mytoken&lt;/span&gt; &lt;span style=&#34;color:#75715e&#34;&gt;# ZORO TOKEN&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In my case the web server is running debian. The package I installed ntfy with also comes with a systemd service for ntfy (server and client). Before running it, I want to configure it to use a dedicated user, so just to be sure, I ran &lt;code&gt;systemctl disable ntfy&lt;/code&gt;. The &lt;code&gt;export NTFY_UPDATE_TOPIC…&lt;/code&gt; is used to avoid writing the topic name in the public bash script.&lt;/p&gt;&#xA;&lt;p&gt;To use the service as a specific user, which is my case, as I want to run it with the same user that has the permission to deploy the new code. For that, override systemd service by creating the &lt;code&gt;/etc/systemd/system/ntfy-client.service.d/override.conf&lt;/code&gt; file:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-nil&#34; data-lang=&#34;nil&#34;&gt;[Service]&#xA;User=yourUser&#xA;Group=yourUserGroup&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, enable and start systemd service:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;systemctrl enable ntfy-client.service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;systemctrl start ntfy-client.service&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And now the web server listen to the topic configured in the &lt;code&gt;client.yml&lt;/code&gt; file. Each time sourcehut will send a message on that topic, the deamon will read it and launch the &lt;code&gt;update_blog&lt;/code&gt; script, with the received title as an argument.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;webserver-scripts&#34;&gt;Webserver scripts&lt;/h3&gt;&#xA;&lt;p&gt;Now that ntfy is correctly installed and configured on all side, let&amp;rsquo;s look into what the web server does once a message is received. First, it takes the 2nd argument (the job ID) and will use the &lt;a href=&#34;https://git.sr.ht/~emersion/hut&#34;&gt;Hut&lt;/a&gt; tool (CLI for working with sourcehut APIs) to retrieve the job artifacts. It will then download the &lt;code&gt;website.tgz&lt;/code&gt; file, untar/uncompress it, and then &lt;code&gt;rsync&lt;/code&gt; it with the public folder. The full script:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;jobID&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$2&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;JobID recieved: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;jobID&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Just wait in case the artifact are not published yet.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Shouldn&amp;#39;t be long, ntfy notif is sent in last step.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sleep &lt;span style=&#34;color:#ae81ff&#34;&gt;15&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;download_dir&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/home/bacardi55/_deploy/download&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;website_destination&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/srv/www/bacardi55.io&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;artifacts&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;/usr/bin/hut builds artifacts &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;jobID&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;website_artifact&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;$(&lt;/span&gt;echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$artifacts&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; | grep &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;website.tgz&amp;#34;&lt;/span&gt; | awk -F &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;{print $4}&amp;#39;&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;wget --directory-prefix &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;website_artifact:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;||&lt;/span&gt; exit&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/website&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; mv &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/website.tgz&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/website&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;cd &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/website&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; tar xf website.tgz .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rsync -avzhP --delete &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;/website/public/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;website_destination:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Send ntfy message:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;/usr/bin/ntfy publish --title&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blog has been updated&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;NTFY_UPDATE_TOPIC&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Blog was updated after successful build #&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;JOB_ID&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &amp;gt; /dev/null 2&amp;gt;&amp;amp;&lt;span style=&#34;color:#ae81ff&#34;&gt;1&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#75715e&#34;&gt;# Cleaning:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;${&lt;/span&gt;download_dir:?&lt;span style=&#34;color:#e6db74&#34;&gt;}&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And voilà, I should receive an alert when everything is done.&lt;/p&gt;&#xA;&lt;h3 id=&#34;what-about-deployment-when-a-bookmark-is-added&#34;&gt;What about deployment when a bookmark is added?&lt;/h3&gt;&#xA;&lt;p&gt;At the moment, bookmarks are not automatically published when added to Linkding. And there isn&amp;rsquo;t any CI scheduling other than on git push on the website/capsule repositories, bookmarks are refreshed on the site only when I publish any other changes.&lt;/p&gt;&#xA;&lt;p&gt;To improve this, I have the following ideas:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A regular build (eg: Once per day or one every other day)&lt;/li&gt;&#xA;&lt;li&gt;A cron script that will check at 23h59 if any deployment has been made that day, if not, do one (but still may not be needed if no bookmarks have been added that day)&lt;/li&gt;&#xA;&lt;li&gt;A cron that will check for latest bookmarks and if newer than last time =&amp;gt; run the CI. Unlikely solution as I think it will be to complicated for such a small use case.&lt;/li&gt;&#xA;&lt;li&gt;Other? (Open to ideas!)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;This is a lot less important, I don&amp;rsquo;t mind mass publishing bookmarks because I waited a few days before deploying a new content. I&amp;rsquo;m already more or less doing so, as when I publish a new post, all the new bookmarks since last deployed will be added at once… But I&amp;rsquo;m keeping this problem in my todo list to see what I can come up with in the future weeks/months.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;&#xA;&lt;p&gt;That&amp;rsquo;s it for deploying the blog on my webserver within my homelab. Hopefully, it was clear enough. The next and final steps are to build and deploy the gemini capsule, but that&amp;rsquo;s for a later post.&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>Unnecessary Complex Deployment Workflow: Context and Ideas</title><link>https://bacardi55.io/2024/03/26/unnecessary-complex-deployment-workflow-context-and-ideas/</link><pubDate>Tue, 26 Mar 2024 00:00:00 +0100</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2024/03/26/unnecessary-complex-deployment-workflow-context-and-ideas/</guid><description>&lt;p&gt;Say differently: « Forcing creativity by adding constraints » :D.&lt;/p&gt;&#xA;&lt;p&gt;Nota: The draft of this post became so long that I decided to cut it in not 2 but 3(!) different posts… This first post is about the context, constraints and the plan. The next one will be the common CI setups and the blog specific build aspect. The last one will focus on the gemini capsule and its specificity.&lt;/p&gt;&#xA;&lt;h2 id=&#34;introduction&#34;&gt;Introduction&lt;/h2&gt;&#xA;&lt;p&gt;This first post is (still) a long post about the concept for my deployment workflow for my blog and gemini capsule. It will describe the constraints I have as a starting points, the ideas I imagined and the actual solution I&amp;rsquo;m working on. Details about the setup will follow in the next 2 posts of this series.&lt;/p&gt;&#xA;&lt;p&gt;This new process is already fully implemented for this blog, but not yet for my gemini capsule. 2 reasons for that:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;My capsule is still hosted (with other capsules) on a Digital Ocean droplet and need to be migrated to my homelab (goal: before end of June). I&amp;rsquo;ll setup the new deployment workflow for my capsule only on the new hosting (homelab), not before (to avoid doing it twice)&lt;/li&gt;&#xA;&lt;li&gt;I&amp;rsquo;m having a hard time finding a good way to transform markdown into gemtext for my blog posts. So I&amp;rsquo;m actually thinking about what is the best approach for that and the future of my Gemini capsule (more on that later in a gemlog)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;My previous process was simpler and easier: a small &lt;code&gt;deploy.sh&lt;/code&gt; script that builds public files and deploys them to the web server via rsync. And the same thing for my capsule. It was a bit more complicated than that because of gemini files and stuff, but still, the idea was just to run this deploy script from the root directory of my hugo blog and that was it. If you want to look at it, it is still in the &lt;a href=&#34;https://git.sr.ht/~bacardi55/website/tree/f28fe594ade371fd1c2f4fdc2dc2e49de2f66184/item/deploy.sh&#34;&gt;git history&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Why do I want to change a perfectly working process? It has one major drawback: I could not publish anything on my website from outside my house network. Just to change this specific point, while keeping the same list of constraints, it took &amp;ldquo;a lot&amp;rdquo; of &amp;ldquo;work&amp;rdquo;… Some of those constraints are ideological, some are personal preferences, some are good practices, most if not all of them are fully subjective :).&lt;/p&gt;&#xA;&lt;p&gt;At least, it has been working flawlessly for this site for the past 4 or 5 weeks :).&lt;/p&gt;&#xA;&lt;p&gt;If you have a better solution, &lt;strong&gt;&lt;strong&gt;while keeping the constraints list as is&lt;/strong&gt;&lt;/strong&gt; (too easy otherwise :)), I&amp;rsquo;d be happy to hear about it! See the &lt;a href=&#34;https://bacardi55.io/pages/about/&#34;&gt;About page&lt;/a&gt; for ways to reach me out!&lt;/p&gt;&#xA;&lt;h2 id=&#34;constraints&#34;&gt;Constraints&lt;/h2&gt;&#xA;&lt;p&gt;So… As said, many constraints… Some basics, some weird, some due to what content is deployed where… I&amp;rsquo;m trying to be exhaustive here, so some may be obvious.&lt;/p&gt;&#xA;&lt;h3 id=&#34;basics-constraints&#34;&gt;Basics constraints&lt;/h3&gt;&#xA;&lt;h4 id=&#34;static-generated-website-capsule&#34;&gt;Static Generated {website,capsule}&lt;/h4&gt;&#xA;&lt;p&gt;Obvious, but I don&amp;rsquo;t use a dynamic CMS but &lt;a href=&#34;https://gohugo.io&#34;&gt;Hugo&lt;/a&gt;, a static site generator for this blog. It means I can&amp;rsquo;t edit its content via a web browser, but by adding markdown files within the codebase and building the public files to put on a web server. I won&amp;rsquo;t move away from Hugo (and SSG) at this stage.&lt;/p&gt;&#xA;&lt;p&gt;Same for my gemini capsule, I&amp;rsquo;m using a static capsule generator called &lt;a href=&#34;https://git.sr.ht/~adnano/kiln&#34;&gt;kiln&lt;/a&gt; and that most probably won&amp;rsquo;t change (this one is slightly more open than hugo, but not much).&lt;/p&gt;&#xA;&lt;h4 id=&#34;source-code-on-sourcehut&#34;&gt;Source code on sourcehut&lt;/h4&gt;&#xA;&lt;p&gt;I decided some time ago to use &lt;a href=&#34;https://sourcehut.org&#34;&gt;sourcehut&lt;/a&gt; as my primary dev forge. So all my public code are now there, including the 2 blog and capsule repos.&lt;/p&gt;&#xA;&lt;p&gt;Sourcehut has a nice project capabilities to regroup git repo (but also todos and mailing lists) together. That&amp;rsquo;s why I have a dedicated &lt;a href=&#34;https://sr.ht/~bacardi55/writings/&#34;&gt;writing&lt;/a&gt; project that contains the 4 repos required for my blog and capsule.&lt;/p&gt;&#xA;&lt;h4 id=&#34;blog-hosted-in-house&#34;&gt;Blog hosted in house&lt;/h4&gt;&#xA;&lt;p&gt;This blog is hosted in my homelab in a small LXC container running nginx. The container can only be reached only from the reverse proxy (also nginx in my homelab) via HTTP (or via ssh only from my local network).&lt;/p&gt;&#xA;&lt;h4 id=&#34;capsule-hosted-in-the-cloud-for-now&#34;&gt;Capsule hosted in the cloud… For now!&lt;/h4&gt;&#xA;&lt;p&gt;All the gemini capsules I host are right now on digital ocean droplet… But they will all be migrated to my homelab soon-ish. It means that right now I can update my capsule from everywhere, but I will have the same limitation as the blog once they are migrated home. So let&amp;rsquo;s fix both at once.&lt;/p&gt;&#xA;&lt;h4 id=&#34;ingress-http--s--only&#34;&gt;Ingress HTTP(S) only&lt;/h4&gt;&#xA;&lt;p&gt;Biggest constraint that started all of this, my home network only accepts HTTP and HTTPS incoming connection on port 80 and 443 (and at some point 1965 for Gemini). It means that I can not ssh or VPN from outside to my local network. And yes, this is on purpose and won&amp;rsquo;t change.&lt;/p&gt;&#xA;&lt;h4 id=&#34;local-git-repo-not-available-from-outside&#34;&gt;Local Git repo not available from outside&lt;/h4&gt;&#xA;&lt;p&gt;Since the &lt;a href=&#34;https://sourcehut.org/blog/2024-01-16-sourcehut-outage/&#34;&gt;last attack&lt;/a&gt; on &lt;a href=&#34;https://sr.ht&#34;&gt;sourcehut&lt;/a&gt;, I decided to run a local Git repository (a &lt;a href=&#34;https://forgejo.org/&#34;&gt;forgejo&lt;/a&gt; instance) on my homelab. But it is only available on my local network for the same reason as above (and also to avoid git repository crawler). I&amp;rsquo;ll write later a post about how I manage my project in different git forges, but for the sake of this post, let&amp;rsquo;s just say that I can not commit on this forge for outside, so using it as the main forge with a CI tool is not possible.&lt;/p&gt;&#xA;&lt;h3 id=&#34;intertwined-content-constraints&#34;&gt;Intertwined content constraints&lt;/h3&gt;&#xA;&lt;p&gt;Now the fun starts with constraints related to which content should be where! The way I want things:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;(Blog and Gemlog posts are written in emacs and exported in the right format (markdown for blog posts, gemtext for gemlog entries) in the right project / folder)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/gemlog/&#34;&gt;Gemlog&lt;/a&gt; entry&amp;rsquo;s title visible on the web, not their content (markdown files with just the frontmatter part), fully readable on gemini. HTML files even removed from the web.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/posts/&#34;&gt;Blog&lt;/a&gt; post entry fully readable on the web and gemini&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/bookmarks/&#34;&gt;Bookmarks&lt;/a&gt; are retrieved from Linkding, only visible on the web, not gemini (at least for now, might change in new deployment)&lt;/li&gt;&#xA;&lt;li&gt;Blog &lt;a href=&#34;https://bacardi55.io/pages/&#34;&gt;static pages&lt;/a&gt; are only available on the web, not gemini (won&amp;rsquo;t change)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://git.sr.ht/~bacardi55/website&#34;&gt;blog git&lt;/a&gt; repository only contains content for blog and pages (no bookmarks or gemlog)&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://git.sr.ht/~bacardi55/capsule&#34;&gt;capsule git&lt;/a&gt; repository only contains content for gemlog&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;additional-constraints&#34;&gt;Additional constraints&lt;/h3&gt;&#xA;&lt;p&gt;These are constraints I added during my reflection about possible solutions. Where some of them felt too ugly for some reasons, I added those to the list.&lt;/p&gt;&#xA;&lt;h4 id=&#34;no-local-ci&#34;&gt;No local CI&lt;/h4&gt;&#xA;&lt;p&gt;I surprised myself with this one, but I ended up deciding against selfhosting my own CI tools with either &lt;a href=&#34;https://code.forgejo.org/forgejo/runner&#34;&gt;Forgejo runner&lt;/a&gt; or &lt;a href=&#34;https://woodpecker-ci.org/&#34;&gt;WoodpeckerCI&lt;/a&gt;. Forgejo runner requires docker and my current forgejo instance is installed on a Container, not VM, so not great for adding docker. Didn&amp;rsquo;t want to add another VM for that on proxmox. WoodpeckerCI seems great but way to complicated to manage for my micro use case, so I discarded it as well.&lt;/p&gt;&#xA;&lt;p&gt;You may ask yourself: &amp;ldquo;well, you couldn&amp;rsquo;t commit to your local Git repo anyway, what&amp;rsquo;s the difference here?&amp;rdquo;. Well, I had the potential crazy idea of mirroring my sourcehut repo on a copy on forgejo, then use the CI tool to automate the build. But that was not a idea I liked at all. But fun to think about still :).&lt;/p&gt;&#xA;&lt;h4 id=&#34;don-t-be-evil&#34;&gt;« Don&amp;rsquo;t be evil »©&lt;/h4&gt;&#xA;&lt;p&gt;This one is a bit weird, but came because one of the idea I had: to avoid &amp;ldquo;alerting&amp;rdquo; my webserver that a new artifact has been created via sourcehut CI, I could simply start automatically a build from the server regularly, wait for it to finish and then use this generated artifact. But that meant having regular CI jobs and generated artifact even when not needed.&lt;/p&gt;&#xA;&lt;p&gt;While not really a problem, I didn&amp;rsquo;t want to go that road. Specially if I didn&amp;rsquo;t want to wait too long between the commit and the deployment. For example, to have a maximum of 1h between push and deployhment, the CI would had to run (and generate/store artifacts) every hour. Ridiculous idea as well, I didn&amp;rsquo;t want to store 24 artifacts per day (times 2 with the gemini capsule artifact) for 90 days… Such a waste!&lt;/p&gt;&#xA;&lt;h3 id=&#34;bonus-1-the-bookmarks-issue&#34;&gt;Bonus 1: the Bookmarks &amp;ldquo;issue&amp;rdquo;&lt;/h3&gt;&#xA;&lt;p&gt;As said, the &lt;a href=&#34;https://bacardi55.io/bookmarks/&#34;&gt;bookmarks&lt;/a&gt; comes from a selfhosted &lt;a href=&#34;https://github.com/bachya/linkding&#34;&gt;Linkding&lt;/a&gt; instance (&lt;a href=&#34;https://bacardi55.io/2024/02/13/bookmarks-section-the-pesos-way-kind-of/&#34;&gt;read more about it&lt;/a&gt;). It means that there are no commits for bookmarks, they are generated when the website output is generated. So no automated CI based on pushed commits.&lt;/p&gt;&#xA;&lt;p&gt;Would be a bonus to have a better way of doing so with the new process, because I may not post for weeks/months at some point, and having at least bookmarks still updated regularly would mean having this site kept alive without new blog or gemlog posts.&lt;/p&gt;&#xA;&lt;p&gt;I could make the CI run every day at least once, but I don&amp;rsquo;t really find it an &amp;ldquo;elegant&amp;rdquo; solution… Waiting for a blog post to update the site may mean having 10s of new bookmarks if a new posts is published a long time after the last one.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;m still thinking about the best approach for this one.&lt;/p&gt;&#xA;&lt;h3 id=&#34;bonus-2-statistics&#34;&gt;Bonus 2: Statistics&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;http://localhost:1313/2024/03/07/generating-basic-content-statistics-for-static-site-generator/&#34;&gt;Not so long ago&lt;/a&gt;, I added a &lt;a href=&#34;https://bacardi55.io/pages/stats/&#34;&gt;stats page&lt;/a&gt; to show some information about the content available on this site (how many posts per month, per type, etc…). Those statistics are calculated as well during the build process based on the markdown files. It has to run after all contents are gathered, including bookmarks and gemlogs. It will generate a json file and images that are used during the generation of the public files via hugo.&lt;/p&gt;&#xA;&lt;p&gt;Maybe I can reuse this to display those stats within my Capsule. This is a very low priority task, but I have it in the back of my mind anyway.&lt;/p&gt;&#xA;&lt;h2 id=&#34;solution-overview&#34;&gt;Solution overview&lt;/h2&gt;&#xA;&lt;p&gt;After saying all this, the solution I found and implemented is built upon the workflow described bellow. This is a &amp;ldquo;quick&amp;rdquo; overview, the solution will be detailed future posts.&lt;/p&gt;&#xA;&lt;h3 id=&#34;in-one-image&#34;&gt;In one image&lt;/h3&gt;&#xA;&lt;figure&gt;&lt;img src=&#34;https://bacardi55.io/images/posts/2024/03/ci-cd.png&#34;&#xA;    alt=&#34;Figure 1: Diagram of the deployment workflow&#34;&gt;&lt;figcaption&gt;&#xA;      &lt;p&gt;&lt;span class=&#34;figure-number&#34;&gt;Figure 1: &lt;/span&gt;Diagram of the deployment workflow&lt;/p&gt;&#xA;    &lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&lt;h3 id=&#34;the-different-build-steps&#34;&gt;The different build steps&lt;/h3&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Push a new content via git (either on blog or capsule)&lt;/li&gt;&#xA;&lt;li&gt;Sourcehut CI starts a build automatically and will generate 2 artifacts: public website files and public capsule files (so 1 build for both).&lt;/li&gt;&#xA;&lt;li&gt;Build artifacts process:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Download required dependencies and clone the 4 git repositories (&lt;a href=&#34;https://git.sr.ht/~bacardi55/website&#34;&gt;blog&lt;/a&gt;, &lt;a href=&#34;https://git.sr.ht/~bacardi55/capsule&#34;&gt;capsule&lt;/a&gt;, &lt;a href=&#34;https://git.sr.ht/~bacardi55/MinIndie&#34;&gt;custom theme&lt;/a&gt; and &lt;a href=&#34;https://git.sr.ht/~bacardi55/writting-deploy&#34;&gt;build scripts&lt;/a&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Manage content from different sources:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/bookmarks/&#34;&gt;Bookmarks&lt;/a&gt; are fetched from &lt;a href=&#34;https://github.com/bachya/linkding&#34;&gt;Linkding&lt;/a&gt; via API in a python script to generates markdown files in the right folder (&lt;code&gt;hugoRootDir/content/bookmarks/&lt;/code&gt;) for each shared bookmarks.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/gemlog/&#34;&gt;Gemlog&lt;/a&gt; entries are simply copied from the capsule git directory to the blog one after being transformed (more on that in the next post, but basically removing content after the frontmatter area and changing the extension from &lt;code&gt;gmi&lt;/code&gt; to &lt;code&gt;md&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://bacardi55.io/posts&#34;&gt;Blog posts&lt;/a&gt; are also copied to the capsule directory and will be transformed into gemtext from markdown&lt;sup id=&#34;fnref:2&#34;&gt;&lt;a href=&#34;#fn:2&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;2&lt;/a&gt;&lt;/sup&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;After retrieving all content, &lt;a href=&#34;https://bacardi55.io/pages/stats/&#34;&gt;statistics&lt;/a&gt; are generated (&lt;a href=&#34;https://bacardi55.io/2024/03/07/generating-basic-content-statistics-for-static-site-generator/&#34;&gt;read more&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;If build is successful, send a message to a selfhosted &lt;a href=&#34;https://ntfy.sh&#34;&gt;ntfy&lt;/a&gt; instance on a private topic with the build number&lt;/li&gt;&#xA;&lt;li&gt;Web (Zoro) and Capsule (Brook) servers subscribe to this ntfy topic&lt;/li&gt;&#xA;&lt;li&gt;Deploy:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Web server retrieve via sourcehut build ID the artifact with website files, uncompress and rsync it to the right folder.&lt;/li&gt;&#xA;&lt;li&gt;Capsule server will do the same once this new process is in place for it, but not yet.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Success:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Web server send ntfy message on another topic to alert me that the deployment have been successful&lt;/li&gt;&#xA;&lt;li&gt;Capsule server will do the same once this new process is in place for it, but not yet.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;And voilà! Too complicated for nothing, but as it is now fully automated, it becomes transparent, and the complexity is almost forgotten (until something breaks :)).&lt;/p&gt;&#xA;&lt;h2 id=&#34;pros-cons&#34;&gt;Pros / Cons&lt;/h2&gt;&#xA;&lt;h3 id=&#34;pros&#34;&gt;Pros&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I can make updates from everywhere (I&amp;rsquo;d sure hope so, that was the initial goal…)&lt;/li&gt;&#xA;&lt;li&gt;Automated process, all I need is push files via git.&lt;/li&gt;&#xA;&lt;li&gt;A good side effet of this is that I had to do some clean up between the theme repo and the blog repo&lt;/li&gt;&#xA;&lt;li&gt;Can be manually started via sourcehut web UI, via API (or &lt;a href=&#34;https://git.sr.ht/~emersion/hut&#34;&gt;hut cli&lt;/a&gt;) if needed.&lt;/li&gt;&#xA;&lt;li&gt;I can work on changing blog files locally and still publish new content even if my local version is more or less broken. Before I couldn&amp;rsquo;t because the deploy script would use the build folder as is.&lt;/li&gt;&#xA;&lt;li&gt;Artifacts are perfectly reproducible now, wasn&amp;rsquo;t 100% the case before.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;cons&#34;&gt;Cons&lt;/h3&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Takes longer than before (±3min instead of 15sec), but it is still fast enough for me&lt;/li&gt;&#xA;&lt;li&gt;More complex to maintain / change / debug compare to a simple bash script as it contains multiple build files in both bash and python…&lt;/li&gt;&#xA;&lt;li&gt;The Gemini capsule part is more complex because of the lack of good solution to generate gemtext from markdown&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;small-introspection-before-ending-this-post&#34;&gt;Small introspection before ending this post…&lt;/h2&gt;&#xA;&lt;p&gt;Before going into the solution details in the next post, let&amp;rsquo;s ask myself this: &amp;ldquo;Was it worth it to spend that much time automating all this, even though you had a perfectly simple and working solution in place? Just for the possibility that, maybe one day, you may publish a post while not at home ?&amp;rdquo;.&lt;/p&gt;&#xA;&lt;p&gt;Well, self, since you ask such a long question… I &lt;strong&gt;&lt;strong&gt;believe&lt;/strong&gt;&lt;/strong&gt; so…?&lt;/p&gt;&#xA;&lt;p&gt;I had fun playing with sourcehut CI and all these scripts… So I&amp;rsquo;d say yes! I may have spent more time working on this that the amount of time I&amp;rsquo;ve spent last year writing blog post from outside (because it actually didn&amp;rsquo;t happen) and I still haven&amp;rsquo;t published a post from outside yet… So on that front you may say no…&lt;/p&gt;&#xA;&lt;p&gt;Another reason I did it was the &lt;a href=&#34;https://indieweb.org&#34;&gt;IndieWeb&lt;/a&gt; and its philosophy. What does it have to do with this, you may ask. Well, it makes me want to make this site even more my &amp;ldquo;online source of truth&amp;rdquo; (for content at least). So there is a high possibility that I&amp;rsquo;m going to add a &lt;code&gt;notes&lt;/code&gt; content type for a more micro blog type of content (most probably linked to my personal fediverse account). At least for &amp;ldquo;toot&amp;rdquo; that I&amp;rsquo;d prefer to be less ephemeral than on the Fediverse only. More on that later, but I&amp;rsquo;m mentioning it because if I indeed add them, I will probably publish a lot more (smaller) content and there is a higher chance that I want to do that from outside my home. Finding a way to do that from my phone might be the biggest issue, but I&amp;rsquo;ll look into this later.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;&#xA;&lt;p&gt;At the end of the day, it isn&amp;rsquo;t &lt;strong&gt;&lt;strong&gt;that&lt;/strong&gt;&lt;/strong&gt; complicated: a CI is running on git changes to create artifact to be deployed and alert my servers via ntfy. Local servers then retrieve artifacts and deploy them. Why does this need 3 long posts then?? I&amp;rsquo;m not even sure, but that may be my inability to be concise on this blog (which is weird because I&amp;rsquo;m usually not bad at doing so at my day job…).&lt;/p&gt;&#xA;&lt;p&gt;Anyway, 2nd post of this series is already well advanced, as opposed to the 3rd one that is blocked until I find a solution that I like for my displaying (or not) my web content on my Gemini capsule.&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;: It isn&amp;rsquo;t true as of right now because of the capsule migration not being effective, but will be when the capsule is back on my homelab&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li id=&#34;fn:2&#34;&gt;&#xA;&lt;p&gt;: I have tried a few things, but so far no luck, so very open to ideas and suggestions&amp;#160;&lt;a href=&#34;#fnref:2&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;</description></item>
    <item>
      
      <title>Managing your gemini feeds with Comitium and docker</title><link>https://bacardi55.io/2021/04/08/managing-your-gemini-feeds-with-comitium-and-docker/</link><pubDate>Thu, 08 Apr 2021 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2021/04/08/managing-your-gemini-feeds-with-comitium-and-docker/</guid><description>&lt;h2 id=&#34;context&#34;&gt;Context&lt;/h2&gt;&#xA;&lt;p&gt;If you read this blog before, you know that I&amp;rsquo;ve become a big fan of the&#xA;&lt;a href=&#34;https://gemini.circumlunar.space/&#34;&gt;gemini space&lt;/a&gt; and that I do run&#xA;&lt;a href=&#34;&#34;&gt;a capsule&lt;/a&gt; with specific content on there&#xA;:). I&amp;rsquo;ve been enjoying reading many gemlog over the past months and the&#xA;list is growing :).&lt;/p&gt;&#xA;&lt;p&gt;As for the web, following every capsules is hard to do &amp;ldquo;manually&amp;rdquo; and as&#xA;for the web, having a feed reader is very useful :). Until now, I have&#xA;been using the built-in capability of&#xA;&lt;a href=&#34;https://github.com/makeworld-the-better-one/amfora&#34;&gt;amfora gemini&#xA;browser&lt;/a&gt; to subscribe to feeds and it has worked flawlessly (I love&#xA;this browser :)). But the issue I have with it is that it is link to my&#xA;laptop and the local installation of amfora. If I browse the gemini&#xA;space on my phone, I still need to see what&amp;rsquo;s new in the capsule I&#xA;follow. I won&amp;rsquo;t write more about this, this is the same idea of having a&#xA;web rss feed like &lt;a href=&#34;https://www.freshrss.org&#34;&gt;freshrss&lt;/a&gt; or&#xA;&lt;a href=&#34;https://miniflux.app/&#34;&gt;miniflux&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I won&amp;rsquo;t talk about how much I love following gemlogs at the moment and&#xA;how it reminds me of the early days of following bloggers online as it&#xA;will be the goal of a dedicated gemlog post^^.&lt;/p&gt;&#xA;&lt;p&gt;There are multiple feed readers for gemini, like&#xA;&lt;a href=&#34;https://sr.ht/~sircmpwn/gemreader/&#34;&gt;Gemreader&lt;/a&gt;,&#xA;&lt;a href=&#34;https://sr.ht/~callum/gmisub/&#34;&gt;Gmisub&lt;/a&gt;,&#xA;&lt;a href=&#34;https://github.com/kensanata/moku-pona&#34;&gt;Moku-Pona&lt;/a&gt;,&#xA;&lt;a href=&#34;https://git.nytpu.com/comitium/about/&#34;&gt;comitium&lt;/a&gt;, and probably&#xA;others&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;I selected comitium in the end, as it seemed very simple to install and&#xA;manage. And it does exactly what I need :]. So far, it has worked for a&#xA;couple of days quite nicely :).&lt;/p&gt;&#xA;&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;&#xA;&lt;p&gt;So first thing first, as you know, I manage everything in docker in my&#xA;self hosted environment. As always, I&amp;rsquo;m not saying this is the right way&#xA;of doing it, just a way I enjoy ^^.&lt;/p&gt;&#xA;&lt;p&gt;Anyway, no need to deploy a swarm stack for comitium, I just need to run&#xA;it every X hours to refresh the feeds. I could have installed comitium&#xA;on one of the node, but I didn&amp;rsquo;t want to install go locally on the host.&#xA;So let&amp;rsquo;s use a very simple image to create the gmi files. Comitium will&#xA;generate files to deploy to your gemini server. More on that later.&lt;/p&gt;&#xA;&lt;h3 id=&#34;image-creation&#34;&gt;Image Creation&lt;/h3&gt;&#xA;&lt;p&gt;No public image yet to reuse, but as you know I like having my own built&#xA;images. I have my &amp;ldquo;preprod&amp;rdquo; rpi with my local registry on it as&#xA;explained&#xA;&lt;a href=&#34;https://bacardi55.io/2021/03/29/home-lab-part-8-create-a-local-docker-registry-to-manage-your-own-images/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;This is an example of an extremely simple Dockerfile:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    FROM golang:1.15&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    RUN \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       git clone https://git.sr.ht/~sircmpwn/scdoc &amp;amp;&amp;amp; cd scdoc &amp;amp;&amp;amp; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       make &amp;amp;&amp;amp; make install &amp;amp;&amp;amp; cd ..&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    RUN \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       git clone https://git.nytpu.com/comitium &amp;amp;&amp;amp; cd comitium &amp;amp;&amp;amp; \&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;       make &amp;amp;&amp;amp; make install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    VOLUME /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;No entrypoint or command as we will have to use different commands&#xA;(add/remove/refresh).&lt;/p&gt;&#xA;&lt;p&gt;Then, build the image:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker build .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If it works, you can tag the image:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker build . -t registry.local:5000/b55-comitium:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, you can do a test run:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker run -it --rm -v /home/pi/testdir/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium add &amp;lt;GeminiFeedUrl&amp;gt; -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It should generate files in the data directory (&lt;code&gt;feeds.gmi&lt;/code&gt;,&#xA;&lt;code&gt;subscriptions.gmi&lt;/code&gt;, &lt;code&gt;comitium.json&lt;/code&gt;).&lt;/p&gt;&#xA;&lt;h3 id=&#34;usage-on-the-cluster&#34;&gt;Usage on the cluster&lt;/h3&gt;&#xA;&lt;p&gt;So let&amp;rsquo;s deploy it on the cluster. Ssh to one of the node and:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker pull registry.local:5000/b55-comitium:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Should pull the image from the registry. Adapt to your url/port.&lt;/p&gt;&#xA;&lt;p&gt;Create the data where the files needs to be generated. It could be in a&#xA;directory of your servers or anywhere. In my case, I prefer generating&#xA;it in a dedicated directory and then &lt;code&gt;rsync&lt;/code&gt; it in the right directory&#xA;for the server.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mkdir /path/to/comitium/data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then you can add a feed to test. Same command as on &lt;code&gt;freeza&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker run -it --rm -v /path/to/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium add &amp;lt;GeminiFeedUrl&amp;gt; -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It should generate the files as said above.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Nota&lt;/strong&gt;: You can customize the header of the page by providing a&#xA;&lt;code&gt;header.gmi&lt;/code&gt; file.&lt;/p&gt;&#xA;&lt;p&gt;In my case, I simply use a &lt;code&gt;header.gmi&lt;/code&gt; file containing (with the empty&#xA;line at the end):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    # Bacardi55&amp;#39;s gemini feed subscriptions&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; https://git.nytpu.com/comitium/ This page is generated with comitium&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To refresh the data, this command could be used:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker run -it --rm -v /path/to/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium refresh -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Also, because I make comitium create this files not in the server&#xA;directory, I need to &lt;code&gt;rsync&lt;/code&gt; the files to the right directory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rsync -avzhP /path/to/comitium/data/ /path/to/server/feed/data/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now, what I&amp;rsquo;d like is running comitium on its own hostname, not inside&#xA;my current capsule. In my case, I run it publicly on&#xA;&lt;code&gt;gemini://feeds.gmi.bacardi55.io&lt;/code&gt;. You can have a look at it if you&#xA;want. So I need to copy the &lt;code&gt;feeds.gmi&lt;/code&gt; file as an &lt;code&gt;index.gmi&lt;/code&gt; file so&#xA;it is delivered automatically by the server.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cp /path/to/server/feed/data/feeds.gmi /path/to/server/feed/data/index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now that&amp;rsquo;s cool, but adding and removing feeds with the long docker&#xA;command, the cp and then running rsync is quite boring&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;To simplify this, I created 2 bash functions in my &lt;code&gt;bashrc&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    comitium-add&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      docker run --rm -v /path/to/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium add &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$1&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      rsync -avzhP /path/to/comitium/data/ /path/to/server/feed/data/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      cp /path/to/server/feed/data/feed.gmi /path/to/server/feed/data/index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    comitium-remove&lt;span style=&#34;color:#f92672&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      docker run --rm -v /path/to/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium remove &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$1&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      rsync -avzhP /path/to/comitium/data/ /path/to/server/feed/data/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      cp /path/to/server/feed/data/feed.gmi /path/to/server/feed/data/index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And now, simply running &lt;code&gt;comitium-add &amp;lt;FeedUrl&amp;gt;&lt;/code&gt; and&#xA;&lt;code&gt;comitium-remove &amp;lt;FeedUrl&amp;gt;&lt;/code&gt; to manage feeds.&lt;/p&gt;&#xA;&lt;p&gt;Now, that&amp;rsquo;s great but what we need to finish the setup is a cronjob to&#xA;refresh the feeds. The simpler is instead of a bash function create a&#xA;simple shell script that will do the necessary commands. Create the&#xA;&lt;code&gt;comitium-refresh.sh&lt;/code&gt; file with the following content:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;#!/bin/bash&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker run --rm -v /path/to/comitium/data/:/data registry.local:5000/b55-comitium:latest comitium refresh -d /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rsync -avzhP /path/to/comitium/data/ /path/to/server/feed/data/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cp /path/to/server/feed/data/feed.gmi /path/to/server/feed/data/index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Make it executable:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    chmod +x /path/to/comitium-refresh.sh&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then &lt;code&gt;crontab -e&lt;/code&gt; to add the job:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    30 */6 * * * /path/to/comitium-refresh.sh &amp;gt; /tmp/cr.log 2&amp;gt;&amp;amp;1&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And that should be it. Yes, I only update it every 6 hours, that is&#xA;enough for me.&lt;/p&gt;&#xA;&lt;p&gt;Configure your server to run the files as wished. In my case, I just&#xA;added a second hostname in&#xA;&lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmnisrv&#34;&gt;gmnisrv&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [gmi.bacardi55.io]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    root=/data/gmi.bacardi55.io&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [feeds.gmi.bacardi55.io]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    root=/data/feeds.gmi.bacardi55.io&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And that should be it (:.&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>Moving gmnisrv to my swarm cluster</title><link>https://bacardi55.io/2021/04/04/moving-gmnisrv-to-my-swarm-cluster/</link><pubDate>Sun, 04 Apr 2021 00:00:00 +0200</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2021/04/04/moving-gmnisrv-to-my-swarm-cluster/</guid><description>&lt;h2 id=&#34;context&#34;&gt;Context&lt;/h2&gt;&#xA;&lt;p&gt;Based on my previous post about&#xA;&lt;a href=&#34;https://bacardi55.io/2021/03/29/home-lab-part-8-create-a-local-docker-registry-to-manage-your-own-images/&#34;&gt;managing&#xA;a local docker registry&lt;/a&gt;, as promised let&amp;rsquo;s use it to create a useful&#xA;image and deploy it on &lt;a href=&#34;https://bacardi55.io/pages/home-lab/&#34;&gt;my swarm&#xA;cluster homelab&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;For this example, I&amp;rsquo;ve decided to use the latest image I&amp;rsquo;ve created:&#xA;&lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmnisrv&#34;&gt;gmnisrv&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Wait what? Gmnisrv running on a docker swarm? Why??&lt;/p&gt;&#xA;&lt;p&gt;There are no real good reason to have the gemini server as a docker&#xA;service&amp;hellip; So why? Well the real reasons? Because: - I can :p; - I have&#xA;this docker swarm working very smoothly, so let&amp;rsquo;s use it; - I could have&#xA;just installed it directly on one of the node, but that made not much&#xA;sens; - I can manage it as all the other services^^.&lt;/p&gt;&#xA;&lt;p&gt;Last week, I made the change from the local installation on a test pi to&#xA;the cluster, smoothly from what I&amp;rsquo;ve seen, without certificate change.&#xA;But that&amp;rsquo;s not the point of this article^^ (and TBH, I failed&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; the&#xA;weekend before :D).&lt;/p&gt;&#xA;&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;&#xA;&lt;h3 id=&#34;creating-the-image-for-the-cluster&#34;&gt;Creating the image for the cluster&lt;/h3&gt;&#xA;&lt;p&gt;So first thing first, we need to create the image on the registry before&#xA;being able to use it on the cluster. Feel free to refer to my post about&#xA;&lt;a href=&#34;https://bacardi55.io/2021/03/29/home-lab-part-8-create-a-local-docker-registry-to-manage-your-own-images/&#34;&gt;managing&#xA;a local docker registry&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;On the registry (in my case named &lt;code&gt;freeza&lt;/code&gt;), let&amp;rsquo;s create the image.&#xA;Let&amp;rsquo;s create a working directory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mkdir ~/dockerfiles/gmnisrv &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; cd ~/dockerfiles/gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, create the very simple &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    FROM alpine:3.12&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    RUN apk add --no-cache git make scdoc openssl-dev build-base mailcap &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        cd /tmp &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        git clone https://git.sr.ht/~sircmpwn/gmnisrv &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        cd gmnisrv &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        mkdir build &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        cd build &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        ../configure --prefix&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        make &lt;span style=&#34;color:#f92672&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&#34;color:#ae81ff&#34;&gt;\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#ae81ff&#34;&gt;&lt;/span&gt;        make install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    VOLUME /certs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    VOLUME /config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    VOLUME /data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    CMD &lt;span style=&#34;color:#f92672&#34;&gt;[&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;gmnisrv&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;-C&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/config/gmnisrv.ini&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Very simple :-).&lt;/p&gt;&#xA;&lt;p&gt;Then, let&amp;rsquo;s try and build the image:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker build .&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If this works correctly, you can tag the image (I always prefix their&#xA;name with &lt;code&gt;b55-&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker build . -t registry.local:5000/b55-gmnisrv:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Adapt with your registry hostname and port.&lt;/p&gt;&#xA;&lt;p&gt;Push the image to the directory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    docker push registry.local:5000/b55-gmnisrv:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;To test the image, you can either use &lt;code&gt;docker run&lt;/code&gt; or &lt;code&gt;docker-compose&lt;/code&gt;.&#xA;Because I&amp;rsquo;m will use a docker-compose file on my cluster, I prefer&#xA;testing it with a docker-compose file, buit this doesn&amp;rsquo;t matter.&lt;/p&gt;&#xA;&lt;p&gt;In my case, the local docker-compose.yml file is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    version: &amp;#39;3&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    services:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      gmnisrv:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        image: registry.local:5000/b55-gmnisrv:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ports:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - 1965:1965&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        volumes:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/testdir/gmnisrv/data/:/data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/testdir/gmnisrv/config/:/config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/testdir/gmnisrv/certs:/certs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then the usual &lt;code&gt;docker-compose up&lt;/code&gt; to see if this works correctly (be&#xA;sure to create the volumes if you want to try with it).&lt;/p&gt;&#xA;&lt;p&gt;If you want to run a full test before deploying on your cluster, you can&#xA;create a simple .gmi file in the &lt;em&gt;data&lt;/em&gt; directory, create a dev host in&#xA;the gmnisrv config file (and edit your host file).&lt;/p&gt;&#xA;&lt;h3 id=&#34;deploying-it-to-the-cluster&#34;&gt;Deploying it to the cluster&lt;/h3&gt;&#xA;&lt;p&gt;If everything work, we can use it on the cluster. Adapt a bit the docker&#xA;file to have:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    version: &amp;#39;3&amp;#39;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    services:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      server:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        image: registry.local:5000/b55-gmnisrv:latest&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ports:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - &amp;#34;1965:1965&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        deploy:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          placement:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            constraints:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              - node.hostname == ptitcell2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        volumes:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/containers-data/gmnisrv/data/:/data&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/containers-data/gmnisrv/certs/:/certs&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          - /path/to/services-config/gmnisrv/config/:/config&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Main difference the placement constraints to a specific node of the&#xA;cluster. I could have use &lt;a href=&#34;https://traefik.io/traefik/&#34;&gt;traefik&lt;/a&gt; for&#xA;load balancing the entry like I do for all services&amp;hellip; But I didn&amp;rsquo;t^^. I&#xA;didn&amp;rsquo;t see the point of adding load to traefik and the node manager for&#xA;gmnisrv that works on a port that will only be used by gmnisrv. Gmnisrv&#xA;support multi hosts anyway if I want to add capsules in the future (I&amp;rsquo;m&#xA;planing to have a feed type of capsule).&lt;/p&gt;&#xA;&lt;p&gt;So, long story short, I force the container to only work on the&#xA;&lt;code&gt;ptitcell2&lt;/code&gt; node. And I forward the 1965 port on my router to the&#xA;&lt;code&gt;ptitcell2&lt;/code&gt; node. I thus save a bit on the manager.&lt;/p&gt;&#xA;&lt;p&gt;If you don&amp;rsquo;t care by recreating new certs (if your capsule wasn&amp;rsquo;t live&#xA;yet), you can just start it like this, otherwise just copy/paste the&#xA;certificates in the right folder before starting the stack with&#xA;&lt;code&gt;docker stack deploy gmnisrv -c /path/to/services-config/gmnisrv/docker-compose.yml&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And voilà :] Granted that I have close to no reader on my capsule, I can&#xA;still say it has worked perfectly since then!&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;In reality I failed for multiple reasons, but also discovered a&#xA;bug in the latest version of gmnisrv. I fixed it with the help of&#xA;&lt;a href=&#34;https://drewdevault.com&#34;&gt;Drew Devault&lt;/a&gt;. Since then my patch&#xA;has been accepted so even if what I wrote was the&#xA;&lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmnisrv/commit/8b65e303b01fc573cb1c40a365fb5db166146a37&#34;&gt;simplest&#xA;patch&lt;/a&gt; in the history of patch, I&amp;rsquo;m still happy about it^^.&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;</description></item>
    <item>
      
      <title>Mixing blog and gemlog content on my blog homepage and RSS feed</title><link>https://bacardi55.io/2021/02/16/mixing-blog-and-gemlog-content-on-my-blog-homepage-and-rss-feed/</link><pubDate>Tue, 16 Feb 2021 00:00:00 +0100</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2021/02/16/mixing-blog-and-gemlog-content-on-my-blog-homepage-and-rss-feed/</guid><description>&lt;h2 id=&#34;context&#34;&gt;Context&lt;/h2&gt;&#xA;&lt;p&gt;After&#xA;&lt;a href=&#34;https://bacardi55.io/2021/02/10/deploying-my-own-gemini-capsule-with-gmnisrv/&#34;&gt;launching&#xA;my Gemini capsule a last week&lt;/a&gt; and&#xA;&lt;a href=&#34;https://bacardi55.io/2021/02/13/managing-this-site-and-my-gemini-capsule-with-hugo/&#34;&gt;explaining&#xA;how I manage both this blog and gemlog with Hugo&lt;/a&gt;, I decided to also&#xA;modify the homepage of this blog and the linked RSS feed.&lt;/p&gt;&#xA;&lt;p&gt;What I wanted was simple: - List on the homepage blog and gemlog posts&#xA;in the same &amp;ldquo;feed&amp;rdquo; - Prefix the gemlog post title with &lt;code&gt;{Gemini} -&lt;/code&gt; -&#xA;Link Gemini posts to &lt;a href=&#34;https://bacardi55.io/pages/gemini&#34;&gt;a dedicated page&lt;/a&gt;, using web anchor to go to the title directly (thanks&#xA;&lt;a href=&#34;https://social.nah.re/@alex&#34;&gt;@alex&lt;/a&gt; for the great idea) - Do the same on the RSS feed (links to the gemini web page, anchored at the gemlog&#xA;post title). - Description of the gemlog post in the RSS feed will&#xA;display a generic message about gemini, not the gemlog content&#xA;(otherwise, there is no point of not making them available on the&#xA;website too.)&lt;/p&gt;&#xA;&lt;h2 id=&#34;setup&#34;&gt;Setup&lt;/h2&gt;&#xA;&lt;h3 id=&#34;setup-the-dedicated-gemini-page&#34;&gt;Setup the dedicated Gemini page&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start with creating a dedicated Gemini page. For that, I created&#xA;the file &lt;code&gt;content/pages/gemini.md&lt;/code&gt; with the following content:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    title: &amp;#34;My Gemlog page&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    slug: &amp;#34;gemini&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    layout: gemini&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Basically to be able to customize the title and specify a specific&#xA;layout to be able to use a dedicated template.&lt;/p&gt;&#xA;&lt;p&gt;Then, let&amp;rsquo;s create the template &lt;code&gt;layouts/_default/gemini.html&lt;/code&gt;. The&#xA;important part to manage the list of gemlog posts is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &amp;lt;h3&amp;gt;All my gemlog posts:&amp;lt;/h3&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;ul class=&amp;#34;note list&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ range where site.RegularPages &amp;#34;Section&amp;#34; &amp;#34;gemlog&amp;#34; }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{- $url := replace .File.Path &amp;#34;.md&amp;#34; &amp;#34;.gmi&amp;#34; -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &amp;lt;li class=&amp;#34;item&amp;#34; id=&amp;#34;{{- .File.UniqueID -}}&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;a href=&amp;#34;gemini://gmi.bacardi55.io/{{- $url | urlize -}}&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;              {{- .Title -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;/a&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &amp;lt;/li&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/ul&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, I&amp;rsquo;m simply using the file unique ID (managed by Hugo) as&#xA;the anchor id.&lt;/p&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s just add a link to this page in the navigation menu, so in the&#xA;&lt;code&gt;config.toml&lt;/code&gt; file, I added:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [[params.nav.custom]]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      title = &amp;#34;Gemini&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      url = &amp;#34;/pages/gemini&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      weight = 3&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Now by generating the site with the &lt;code&gt;hugo&lt;/code&gt; command, the gemini pages&#xA;should be available via the menu.&lt;/p&gt;&#xA;&lt;p&gt;You can see it in action &lt;a href=&#34;https://bacardi55.io/pages/gemini&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The full Gemini page template can be found&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/layouts/_default/gemini.html&#34;&gt;here&lt;/a&gt;.&#xA;You can see the full configuration file&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/config.toml&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;Ok, so the page is now there to be linked from the homepage and the RSS&#xA;feed.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-homepage&#34;&gt;The homepage&lt;/h3&gt;&#xA;&lt;p&gt;Hugo, by default, will list the &amp;ldquo;main section&amp;rdquo; content. In my case, it&#xA;was only posts before. By editing the &lt;code&gt;config.toml&lt;/code&gt;, I can tell hugo&#xA;that the &amp;ldquo;main content&amp;rdquo; is composed of both gemlog and posts:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [params]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      mainSections = [&amp;#34;posts&amp;#34;, &amp;#34;gemlog&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The homepage should now list both type of content, but gemlog title are&#xA;not modified and links point to the html version of the gemlog, so let&amp;rsquo;s&#xA;change that by editing the listing template. In the case of the theme&#xA;I&amp;rsquo;m using and overriding, I needed to create a&#xA;&lt;code&gt;layout/partials/note-list.html&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The important part is there:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{- range $paginator.Pages -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $relURL := replace .RelPermalink &amp;#34;#&amp;#34; &amp;#34;%23&amp;#34; -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $relURL = replace $relURL &amp;#34;.&amp;#34; &amp;#34;%2e&amp;#34; -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;li class=&amp;#34;item&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ if eq .Type &amp;#34;gemlog&amp;#34; }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{- $gurl := replace .File.Path &amp;#34;.md&amp;#34; &amp;#34;.gmi&amp;#34; -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;a class=&amp;#34;note&amp;#34; href=&amp;#34;/pages/gemini#{{- .File.UniqueID -}}&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ else }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;a class=&amp;#34;note&amp;#34; href=&amp;#34;{{- $relURL -}}&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;p class=&amp;#34;note title&amp;#34;&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{ if eq .Type &amp;#34;gemlog&amp;#34; }}{Gemlog} - {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{- .Title | safeHTML -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/p&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{- if .Date -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &amp;lt;p class=&amp;#34;note date&amp;#34;&amp;gt;{{- .Date.Format $dateFormat -}}&amp;lt;/p&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{- end -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;/a&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/li&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{- end -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Basically, when looping on all content, I check if the type of content&#xA;(&lt;code&gt;.Type&lt;/code&gt;) is &lt;code&gt;gemlog&lt;/code&gt;, and if that&amp;rsquo;s the case I put the URL to the&#xA;gemini page &lt;code&gt;/pages/gemini&lt;/code&gt; with the anchor to the right entry, using&#xA;again the &lt;code&gt;.File.UniqueID&lt;/code&gt; to get it. I also change the title by adding&#xA;the suffix &lt;code&gt;{Gemlog} -&lt;/code&gt; for gemlog posts.&lt;/p&gt;&#xA;&lt;p&gt;I kept the same code as before in case of a blog post (using&#xA;&lt;code&gt;.Permalink&lt;/code&gt; rewritten and default title).&lt;/p&gt;&#xA;&lt;p&gt;So now my homepage list both content, with special title and links for&#xA;gemlog entries.&lt;/p&gt;&#xA;&lt;p&gt;You can see the full configuration file&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/config.toml&#34;&gt;here&lt;/a&gt;.&#xA;The full note-list template can be found&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/layouts/partials/note-list.html&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;the-rss-feed&#34;&gt;The RSS feed&lt;/h3&gt;&#xA;&lt;p&gt;Last part was the RSS feed and it works the same way (except the&#xA;template is a xml template and not html). So by copying and adapting the&#xA;default RSS template of the theme I&amp;rsquo;m using like below, I managed to&#xA;have the same behavior as the homepage.&lt;/p&gt;&#xA;&lt;p&gt;The interesting part of the &lt;code&gt;layouts/partials/rss.xml&lt;/code&gt; file is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range first 25 site.RegularPages }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;item&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;title&amp;gt;{{ .Title }}&amp;lt;/title&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{ if eq .Type &amp;#34;gemlog&amp;#34; }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;link&amp;gt;{{- .Site.BaseURL -}}/pages/gemini#{{- .File.UniqueID -}}&amp;lt;/link&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;description&amp;gt;This is a Gemini Log (gemlog) post only visible via the Gemini space. To learn more about what is Gemini and my gemini specific content, please &amp;lt;a href=&amp;#34;{{- .Site.BaseURL -}}/pages/gemini&amp;#34;&amp;gt;read here&amp;lt;/a&amp;gt;&amp;lt;/description&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{ else }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;link&amp;gt;{{ .Permalink }}&amp;lt;/link&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &amp;lt;description&amp;gt;{{ .Content | html }}&amp;lt;/description&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;pubDate&amp;gt;{{ .Date.Format &amp;#34;Mon, 02 Jan 2006 15:04:05 -0700&amp;#34; | safeHTML }}&amp;lt;/pubDate&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{ with .Site.Author.name }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;          &amp;lt;author&amp;gt;{{.}}&amp;lt;/author&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        {{end}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &amp;lt;guid&amp;gt;{{ .Permalink }}&amp;lt;/guid&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      &amp;lt;/item&amp;gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Same kind of things, if the type is &amp;ldquo;gemlog&amp;rdquo;, then I put a special link&#xA;with anchor to the gemini page and prefix the title.&lt;/p&gt;&#xA;&lt;p&gt;The full RSS template can be found&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/layouts/_default/rss.xml&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;&#xA;&lt;p&gt;This is me going deeper in the world of having a &amp;ldquo;similar but different&amp;rdquo;&#xA;online presence on the web and on the gemini space. Hopefully that will&#xA;also help someone else :).&lt;/p&gt;&#xA;&lt;p&gt;You can find all my gemini related blog post&#xA;&lt;a href=&#34;https://bacardi55.io/tags/gemini/&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;</description></item>
    <item>
      
      <title>Managing this site and my gemini capsule with Hugo</title><link>https://bacardi55.io/2021/02/13/managing-this-site-and-my-gemini-capsule-with-hugo/</link><pubDate>Sat, 13 Feb 2021 00:00:00 +0100</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2021/02/13/managing-this-site-and-my-gemini-capsule-with-hugo/</guid><description>&lt;h2 id=&#34;context&#34;&gt;Context&lt;/h2&gt;&#xA;&lt;p&gt;When I &lt;a href=&#34;https://bacardi55.io/2021/02/10/deploying-my-own-gemini-capsule-with-gmnisrv/&#34;&gt;started my gemini capsule&lt;/a&gt;,&#xA;I quickly put a basic mirror of this blog on it as&#xA;a temporary thing. I do have a goal to write specific content on my&#xA;gemini capsule. If you want, you can read about the reasons why I write&#xA;on gemini, I wrote an&#xA;&lt;a href=&#34;&#34;&gt;article&#xA;on my gemini gemlog about it (Gemini link)&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;I worked on it in the past days to achieve something closer to my&#xA;needs: - Having a different weblog and gemlog &amp;ldquo;sites&amp;rdquo;, meaning at least&#xA;the homepage should be different. The homepage of the blog only list the&#xA;blog posts. The homepage of my capsule should first list the latest&#xA;gemlog posts with a link to all gemlog posts and then latest blog posts&#xA;with link to full list pages. - Create blog posts and gemlog posts&#xA;dedicated list pages on the gemini capsule (not needed on the blog where&#xA;only the posts are displayed) - Blog posts must be readable easily via&#xA;gemini, so cleaned from markdown formatting and displaying links&#xA;according to gemini specifications, not markdown. - 1 tool to manage&#xA;both content types, I didn&amp;rsquo;t want to use 2 different static site&#xA;generator (or editing files manually) - RSS feed for the blog posts on&#xA;the weblog, RSS feed for the gemlog posts on the capsule (That part is&#xA;not done yet). - (Optional: List gemlog entries on the blog somewhere so&#xA;at least title would be visible to web visitors)&#xA;Maybe everything I want to achieve is doable with hugo only, but I&#xA;couldn&amp;rsquo;t figure out&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;If you just want to look at the repo, there is a&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io&#34;&gt;github mirror here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;generating-the-site-and-the-capsule&#34;&gt;Generating the site and the capsule&lt;/h2&gt;&#xA;&lt;h3 id=&#34;configure-hugo&#34;&gt;Configure Hugo&lt;/h3&gt;&#xA;&lt;p&gt;First, I created a gemlog content type in my hugo directory:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cd /path/to/hugo/directory/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mkdir content/gemlog/&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, I created the first gemlog entry. I follow the following path:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    content/gemlog/&amp;lt;year&amp;gt;/&amp;lt;month&amp;gt;/&amp;lt;filename&amp;gt;.md&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Just by adding this, I notice that the RSS feed was displaying both&#xA;posts and gemlog entries, so I copied the RSS template from the theme&#xA;I&amp;rsquo;m using to change:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range first 10 .Site.RegularPages }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;to:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range first 10 (where site.RegularPages &amp;#34;Section&amp;#34; &amp;#34;in&amp;#34; &amp;#34;posts&amp;#34;) }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So that part is already taken of.&lt;/p&gt;&#xA;&lt;p&gt;Now, let&amp;rsquo;s configure hugo to generate gmi files. I was inspired by the&#xA;following blog posts (thanks!): -&#xA;&lt;a href=&#34;&#34;&gt;Drew Devault&#xA;article on using Hugo and Gemini (only via gemini)&lt;/a&gt; -&#xA;&lt;a href=&#34;https://sylvaindurand.org/gemini-and-hugo/&#34;&gt;Sylvain Durand blog post&#xA;on using hugo for gemini (WEB)&lt;/a&gt; -&#xA;&lt;a href=&#34;https://doc.huc.fr.eu.org/fr/web/hugo/hugo-gemini-gopher/&#34;&gt;Stéphane&#xA;HUC post on using hugo for gemini and gopher (WEB and French)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;But that didn&amp;rsquo;t work for me. The .gmi files generated for the posts were&#xA;not great and links didn&amp;rsquo;t work.&lt;/p&gt;&#xA;&lt;p&gt;But it worked great to manage the homepage and the section pages (that I&#xA;do not use on the weblog version). To do so, I added this to the&#xA;config.toml:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [mediaTypes]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      [mediaTypes.&amp;#34;text/gemini&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        suffixes = [&amp;#34;gmi&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [outputFormats]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      [outputFormats.Gemini]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        name = &amp;#34;gemini&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        isPlainText = true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        isHTML = false&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        mediaType = &amp;#34;text/gemini&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        protocol = &amp;#34;gemini://&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        permalinkable = true&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        path = &amp;#34;/gemini/&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [outputs]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      home = [&amp;#34;HTML&amp;#34;, &amp;#34;RSS&amp;#34;, &amp;#34;gemini&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      page = [&amp;#34;HTML&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      section = [&amp;#34;gemini&amp;#34;]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will allow generation of a new type of files (.gmi), but only for&#xA;the homepage and the section pages (posts and gemlog).&lt;/p&gt;&#xA;&lt;p&gt;I also added a new config parameter to indicate the geminiBaseUrl. That&#xA;is because I made the choice (not sure why) to use a different subdomain&#xA;for my capsule instead of the same. But that give me the possibility in&#xA;the future to use different servers (at least not on the same network)&#xA;without difficulties.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [params]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      geminiBaseUrl = &amp;#34;gemini://gmi.bacardi55.io&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;creating-the-template-files&#34;&gt;Creating the template files&lt;/h3&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s start with the homepage template for the gemini version&#xA;&lt;code&gt;layout/index.gmi&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;p&gt;You can find the full code&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/layouts/index.gmi&#34;&gt;here&lt;/a&gt;,&#xA;but the main parts are:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range first 5 (where site.RegularPages &amp;#34;Section&amp;#34; &amp;#34;in&amp;#34; &amp;#34;gemlog&amp;#34;) }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := site.Params.dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := .Date.Format $dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; {{ $geminiBaseUrl }}/{{ replace .File.Path &amp;#34;.md&amp;#34; &amp;#34;.gmi&amp;#34; }} {{ .Title }} - {{ $dateFormat }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; {{ $geminiBaseUrl }}/gemlog/index.gmi  All my Gemlog posts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range first 5 (where site.RegularPages &amp;#34;Section&amp;#34; &amp;#34;in&amp;#34; &amp;#34;posts&amp;#34;) }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := site.Params.dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := .Date.Format $dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; {{ $geminiBaseUrl }}/{{ replace .File.Path &amp;#34;.md&amp;#34; &amp;#34;.gmi&amp;#34; }} {{ .Title }} - {{ $dateFormat }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; {{ $geminiBaseUrl }}/posts/index.gmi  All my Blog posts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;These 2 blocks will list the last 5 gemlog entries (and a link to all&#xA;gemlog entries) and then last 5 blog posts (and a link to all blog&#xA;posts).&lt;/p&gt;&#xA;&lt;p&gt;The replace are here to change the .md in the link to .gmi.&lt;/p&gt;&#xA;&lt;p&gt;To be able to change the title of the section page (from &lt;code&gt;Posts&lt;/code&gt; and&#xA;&lt;code&gt;Gemlog&lt;/code&gt;), I created the 2 section root files:&lt;/p&gt;&#xA;&lt;p&gt;In &lt;code&gt;content/posts/_index.md&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    title: Gemlog Posts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In &lt;code&gt;content/gemlog/_index.md&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    title: &amp;#34;Blog Posts&amp;#34;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ---&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, creating the section template files&#xA;(&lt;code&gt;layouts/_default/section.gmi&lt;/code&gt;):&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    # {{ .Title }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ $geminiBaseUrl := site.Params.geminiBaseUrl }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ range .Pages }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := site.Params.dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;      {{- $dateFormat := .Date.Format $dateFormat -}}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    =&amp;gt; {{ $geminiBaseUrl }}/{{ replace .File.Path &amp;#34;.md&amp;#34; &amp;#34;.gmi&amp;#34; }} {{ .Title }} - {{ $dateFormat }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    {{ end }}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Again, replacing the .md into .gmi in the filepath of each content.&lt;/p&gt;&#xA;&lt;h3 id=&#34;generating-the-gemini-sites-dot&#34;&gt;Generating the gemini sites.&lt;/h3&gt;&#xA;&lt;h4 id=&#34;creating-the-structure&#34;&gt;Creating the structure&lt;/h4&gt;&#xA;&lt;p&gt;Because the way hugo is configure now, the generated files for the&#xA;gemini sites are in different places. There are files to move around and&#xA;some other to copy or removed. Let&amp;rsquo;s look at the part of my deployment&#xA;shell script that reorganize everything:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Move files around to dissociate web and gemini:&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mkdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mv &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemini/index.gmi&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cp -r &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/content/posts/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cp -r &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/content/gemlog/&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mv &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/posts/gemini/index.gmi&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/posts/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mv &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/gemini/index.gmi&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rmdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemini/&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rmdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/posts/gemini&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Section are only for gemini output, posts is now empty.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rmdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/posts&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rmdir &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/gemini&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;# Because I don&amp;#39;t want the gemlog files to be available at all on the blog (https):&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rm -rf &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rm &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/posts/_index.md&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    rm &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;$workdir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$public_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/&lt;/span&gt;$gemini_output_dir&lt;span style=&#34;color:#e6db74&#34;&gt;/gemlog/_index.md&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Basically: - Creating a new gemini output directory (let&amp;rsquo;s say&#xA;&lt;code&gt;_gemini_&lt;/code&gt;) - Moving &lt;code&gt;public/gemini/index.gmi&lt;/code&gt; to &lt;code&gt;public/_gemini_/&lt;/code&gt; -&#xA;Copy all blog posts (still in markdown) into &lt;code&gt;public/_gemini_/posts&lt;/code&gt; -&#xA;Copy all gemlog posts (still in markdown) into&#xA;&lt;code&gt;public/_gemini_/gemlog&lt;/code&gt; - Remove useless files and empty directory. - I&#xA;also remove the &lt;code&gt;public/gemlog&lt;/code&gt; directory so gemlog posts are not&#xA;accessible from the web version even if you know the path.&lt;/p&gt;&#xA;&lt;p&gt;The full script&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io/blob/main/deploy.sh&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;To give you an idea, directory structure looks like this at this point&#xA;of the script:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    tree -L &lt;span style=&#34;color:#ae81ff&#34;&gt;2&lt;/span&gt; public/_gemini_&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    public/_gemini_&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ├── gemlog&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    │   ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2021&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    │   └── index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ├── index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    └── posts&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2013&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2016&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2017&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2018&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2020&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        ├── &lt;span style=&#34;color:#ae81ff&#34;&gt;2021&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        └── index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The last issue is that at this point, except the homepage&#xA;(&lt;code&gt;_gemini_/index.gmi&lt;/code&gt;) and the 2 sections pages&#xA;(&lt;code&gt;_gemini_/posts/index.gmi&lt;/code&gt; and &lt;code&gt;_gemini_/gemlog/index.gmi&lt;/code&gt;), all the&#xA;other files are still in markdown&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;This is where&#xA;&lt;a href=&#34;https://github.com/makeworld-the-better-one/md2gemini&#34;&gt;this awesome&#xA;python library&lt;/a&gt; comes to help as it can create gemini files based on&#xA;markdown files (taken care of links and others).&lt;/p&gt;&#xA;&lt;p&gt;My shell deployment script will now call a python script&lt;sup id=&#34;fnref:1&#34;&gt;&lt;a href=&#34;#fn:1&#34; class=&#34;footnote-ref&#34; role=&#34;doc-noteref&#34;&gt;1&lt;/a&gt;&lt;/sup&gt; that will&#xA;read all markdown file, create the gemini equivalent and remove the&#xA;files.&lt;/p&gt;&#xA;&lt;p&gt;The python script looks like this&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#75715e&#34;&gt;#!/usr/bin/python3&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; md2gemini &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; md2gemini&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; os&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#f92672&#34;&gt;from&lt;/span&gt; pathlib &lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; Path&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    result &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; list(&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        Path(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;/path/to/hugo/project/public/_gemini_/&amp;#34;&lt;/span&gt;)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;rglob(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;*.[mM][dD]&amp;#34;&lt;/span&gt;))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%d&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; files to be converted…&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; len(result))&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Starting convertion&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;for&lt;/span&gt; path &lt;span style=&#34;color:#f92672&#34;&gt;in&lt;/span&gt; result:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Loading file: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%s&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt; &amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; path)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        &lt;span style=&#34;color:#66d9ef&#34;&gt;with&lt;/span&gt; open(path, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;r&amp;#34;&lt;/span&gt;) &lt;span style=&#34;color:#66d9ef&#34;&gt;as&lt;/span&gt; f:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            gemini &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; md2gemini(&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                f&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;read(),&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                links&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;paragraph&amp;#34;&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                frontmatter&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                base_url&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;lt;geminidomain&amp;gt;/posts&amp;#34;&lt;/span&gt;, &lt;span style=&#34;color:#75715e&#34;&gt;# change to your needs.&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                plain&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;,&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;                md_links&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;True&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            &lt;span style=&#34;color:#75715e&#34;&gt;#print(gemini)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            p &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; str(path)&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;replace(path&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;suffix, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#39;.gmi&amp;#39;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Creating file: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%s&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; p)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            g &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; open(p, &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;a&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            g&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;write(gemini)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            g&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;close()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Removing file: &lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;%s&lt;/span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;%&lt;/span&gt; path)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            os&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;remove(path)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        print(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;--&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;You will need the mentioned library before running this script, you can&#xA;install it with:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    pip3 install md2gemini&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Again, this will be improved into a single (python) script in the near&#xA;future.&lt;/p&gt;&#xA;&lt;p&gt;You can look at the repo&#xA;&lt;a href=&#34;https://github.com/bacardi55/bacardi55io&#34;&gt;here&lt;/a&gt;. Feel free to ping me&#xA;via email or mastodon if anything is unclear :)&lt;/p&gt;&#xA;&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;&#xA;&lt;hr&gt;&#xA;&lt;ol&gt;&#xA;&lt;li id=&#34;fn:1&#34;&gt;&#xA;&lt;p&gt;I started with a shell script as at first it was only 2 lines (1&#xA;to generate content via &lt;code&gt;hugo&lt;/code&gt; and a simple &lt;code&gt;rsync&lt;/code&gt; command).&#xA;Knowing what I know now, I would have just made 1 python script.&#xA;I still plan to upgrade this into one clean python script at some&#xA;point :).&amp;#160;&lt;a href=&#34;#fnref:1&#34; class=&#34;footnote-backref&#34; role=&#34;doc-backlink&#34;&gt;&amp;#x21a9;&amp;#xfe0e;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;/div&gt;&#xA;</description></item>
    <item>
      
      <title>Deploying my own Gemini capsule with gmnisrv</title><link>https://bacardi55.io/2021/02/10/deploying-my-own-gemini-capsule-with-gmnisrv/</link><pubDate>Wed, 10 Feb 2021 00:00:00 +0100</pubDate><author>bac@rdi55.pl (bacardi55)</author><guid>https://bacardi55.io/2021/02/10/deploying-my-own-gemini-capsule-with-gmnisrv/</guid><description>&lt;p&gt;I&amp;rsquo;ve been following Gemini for a bit of time and as I liked the concept and I love to play with new things, I decided to launch my own gemini capsule (aka, my own &amp;ldquo;site&amp;rdquo; on the gemini &amp;ldquo;web&amp;rdquo;).&lt;/p&gt;&#xA;&lt;p&gt;You can access it here: &lt;a href=&#34;&#34;&gt;gemini://gmi.bacardi55.io&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;&lt;/strong&gt;: The result is not perfect yet. For now I&amp;rsquo;ve only put my blog posts but internal links to other content or images do not fully work yet but I&amp;rsquo;ll fix this later.&lt;/p&gt;&#xA;&lt;p&gt;I do plan to create specific content on gmi at some point, for things that are not really &amp;ldquo;blog post&amp;rdquo; material but still worth typing for my future self :D.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;d like to highlight and thanks some posts that convince me of doing it:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://samsai.eu/post/introduction-to-gemini/&#34;&gt;Samsai introduction to gemini&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve been following Gemini for a bit of time and as I liked the concept&#xA;and I love to play with new things, I decided to launch my own gemini&#xA;capsule (aka, my own &amp;ldquo;site&amp;rdquo; on the gemini &amp;ldquo;web&amp;rdquo;).&lt;/p&gt;&#xA;&lt;p&gt;You can access it here:&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Disclaimer&lt;/strong&gt;: The result is not perfect yet. For now I&amp;rsquo;ve only put my&#xA;blog posts but internal links to other content or images do not fully&#xA;work yet but I&amp;rsquo;ll fix this later.&lt;/p&gt;&#xA;&lt;p&gt;I do plan to create specific content on gmi at some point, for things&#xA;that are not really &amp;ldquo;blog post&amp;rdquo; material but still worth typing for my&#xA;future self :D.&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;d like to highlight and thanks some posts that convince me of doing&#xA;it: - &lt;a href=&#34;https://samsai.eu/post/introduction-to-gemini/&#34;&gt;Samsai&#xA;introduction to gemini&lt;/a&gt; -&#xA;&lt;a href=&#34;https://sylvaindurand.org/discovering-the-gemini-protocol/&#34;&gt;Sylvain&#xA;Durand blog post&lt;/a&gt; (and his other post around using hugo to generate gmi&#xA;file, but more on that in another article) -&#xA;&lt;a href=&#34;https://lottalinuxlinks.com/my-gemini-capsule-has-launched/&#34;&gt;totallinuxlinks&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;And others that I&amp;rsquo;ve seen in my RSS feeds or on mastodon :).&lt;/p&gt;&#xA;&lt;h2 id=&#34;gemini-you-say&#34;&gt;Gemini you say ?&lt;/h2&gt;&#xA;&lt;p&gt;For those that don&amp;rsquo;t know, as said on the&#xA;&lt;a href=&#34;https://gemini.circumlunar.space/&#34;&gt;gemini website&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Gemini is a new, collaboratively designed internet protocol, which&#xA;explores the space inbetween gopher and the web, striving to address&#xA;(perceived) limitations of one while avoiding the (undeniable)&#xA;pitfalls of the other.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;I suggest you read more about it on the&#xA;&lt;a href=&#34;https://gemini.circumlunar.space/docs/faq.html&#34;&gt;FAQ page&lt;/a&gt; that&#xA;contains all the necessary informations :).&lt;/p&gt;&#xA;&lt;h2 id=&#34;gemini-server-setup&#34;&gt;Gemini server setup&lt;/h2&gt;&#xA;&lt;p&gt;I was looking for an extra lightweight server and trying to avoid Go or&#xA;Rust for server part. In the end, I I selected&#xA;&lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmnisrv&#34;&gt;gmnisrv&lt;/a&gt;, developed by&#xA;&lt;a href=&#34;https://drewdevault.com/&#34;&gt;Drew Devault&lt;/a&gt; in C. Easy to install, self&#xA;manage certificate and very light to run on an old raspberry pi.&lt;/p&gt;&#xA;&lt;h3 id=&#34;installation&#34;&gt;Installation&lt;/h3&gt;&#xA;&lt;p&gt;You should already have openssl installed, but if not, install it with&#xA;your packet manager.&lt;/p&gt;&#xA;&lt;p&gt;Also, on the &lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmnisrv&#34;&gt;project page&lt;/a&gt; it&#xA;says that &lt;a href=&#34;https://git.sr.ht/~sircmpwn/scdoc&#34;&gt;scdoc&lt;/a&gt; is optional, but&#xA;I couldn&amp;rsquo;t install without it, so I ended up installing it too.&lt;/p&gt;&#xA;&lt;p&gt;To install scdoc:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    git clone https://git.sr.ht/~sircmpwn/scdoc&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cd scdoc&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    make&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sudo make install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then, to install gmnisrv:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    git clone https://git.sr.ht/~sircmpwn/gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cd gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    mkdir build&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cd build&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ../configure --prefix&lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;/usr&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    make&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sudo make install&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;configuring-the-server&#34;&gt;Configuring the server&lt;/h3&gt;&#xA;&lt;p&gt;Copy the default config file at the right place:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    cp /usr/share/gmnisrv/gmnisrv.ini /etc/gmnisrv.ini&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And edit it as needed for the certificate path and the files path.&lt;/p&gt;&#xA;&lt;p&gt;I use &lt;code&gt;/srv/gemini/gmi.bacardi55.io&lt;/code&gt; as the path where my *.gmi files&#xA;will be.&lt;/p&gt;&#xA;&lt;p&gt;For now, let&amp;rsquo;s create a default hellowolrd page:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    echo &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hellowolrd55!&amp;#34;&lt;/span&gt; &amp;gt; /srv/gemini/gmi.bacardi55.io/index.gmi&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id=&#34;creating-a-systemd-service&#34;&gt;Creating a systemd service&lt;/h3&gt;&#xA;&lt;p&gt;To automate the (re)start of the server, I created a systemd service. To&#xA;do so, I created &lt;code&gt;/etc/systemd/system/gmnisrv.service&lt;/code&gt; with the&#xA;following content:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [Unit]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Description=Gemini Server gminisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    After=network.target&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [Service]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Type=simple&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    # Another Type: forking&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    User=gemini&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    ExecStart=/usr/bin/gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    Restart=always&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    [Install]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    WantedBy=multi-user.target&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, I use a dedicated &lt;code&gt;gemini&lt;/code&gt; user on my system to run it&#xA;as a limited users.&lt;/p&gt;&#xA;&lt;p&gt;Then, enable the service and then start it:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sudo systemctl enable gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    sudo systemctl start gmnisrv&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Remember also that it uses port 1965, so if you selfhost at home, don&amp;rsquo;t&#xA;forget to open the port and redirect flow on this port on the right&#xA;server.&lt;/p&gt;&#xA;&lt;p&gt;To test locally first, edit your &lt;code&gt;/etc/hosts&lt;/code&gt; to map the domain config&#xA;in the server file and the IP of the server in a gemini client.&lt;/p&gt;&#xA;&lt;p&gt;You can find a list of clients on&#xA;&lt;a href=&#34;https://github.com/kr1sp1n/awesome-gemini&#34;&gt;this page&lt;/a&gt;. On my side, I&#xA;used &lt;a href=&#34;https://git.sr.ht/~sircmpwn/gmni&#34;&gt;gmni&lt;/a&gt; but any client will do.&lt;/p&gt;&#xA;&lt;p&gt;To test it works from the outside, either install a cli/tui client on an&#xA;external server or test it via an online portal like&#xA;&lt;a href=&#34;https://portal.mozz.us/gemini/gemini.circumlunar.space/&#34;&gt;this one&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;And voilà, you should see your hellowolrd page :)&lt;/p&gt;&#xA;&lt;p&gt;In the next post, I talk about how I use my blog generator&#xA;&lt;a href=&#34;https://portal.mozz.us/gemini/gemini.circumlunar.space/&#34;&gt;Hugo&lt;/a&gt; to&#xA;generate both this blog and the gemini pages.&lt;/p&gt;&#xA;</description></item>
  </channel>
</rss>
