<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Issues on FloCal</title>
    <link>https://herding.github.io/categories/issues/</link>
    <description>Recent content in Issues on FloCal</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 30 Nov 2025 11:43:43 +0800</lastBuildDate><atom:link href="https://herding.github.io/categories/issues/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Insert Images in Hugo and Automatically Clear `public` Folder</title>
      <link>https://herding.github.io/posts/insert_images_in_hugo_and_automatically_clear_folders/</link>
      <pubDate>Sun, 30 Nov 2025 11:43:43 +0800</pubDate>
      
      <guid>https://herding.github.io/posts/insert_images_in_hugo_and_automatically_clear_folders/</guid>
      <description>&lt;p&gt;When I updated my website, I faced some technical issues: how to insert images into posts and how to automatically clear the &lt;code&gt;public&lt;/code&gt; folder. Now I have solutions to both challenges and would like to share them with you.&lt;/p&gt;
&lt;h1 id=&#34;insert-images&#34;&gt;Insert Images&lt;/h1&gt;
&lt;p&gt;To insert images into posts, I researched online resources and found two important considerations: the correct location for images and the method to load them.&lt;/p&gt;
&lt;p&gt;First, there are two methods to store images in your project. The first method is to place images in the same folder as the post&amp;rsquo;s &lt;code&gt;index.md&lt;/code&gt; file, so they are only loaded by that post. For example:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;..
|
└───content
    |   _index.md
    |
    └───posts
        |   ...
        |
        └───time_management_with_Apple&amp;#39;s_App
            index.md
            img1.png
            img2.png
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The second method is to place images in the &lt;code&gt;static&lt;/code&gt; folder, making them accessible to every page. For example: &lt;code&gt;/static/images/logo.png&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Second, after placing images in the correct location, you can load them using three methods:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Markdown style&lt;/strong&gt;: Use &lt;code&gt;![description](path/to/image)&lt;/code&gt;. For a page bundle, write &lt;code&gt;![daily tasks](img1.png)&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Figure shortcode&lt;/strong&gt; (my preferred method): Hugo&amp;rsquo;s built-in feature. Example: &lt;code&gt;{{ &amp;lt; figure src=&amp;quot;img1.png&amp;quot; title=&amp;quot;Daily tasks&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;600&amp;quot; class=&amp;quot;center&amp;quot; &amp;gt;}}&lt;/code&gt;. (⚠️Please remove the blank between &lt;code&gt;{&lt;/code&gt; and &lt;code&gt;&amp;lt;&lt;/code&gt; when you use it.) This method offers more control over styling through CSS or SCSS. I used an AI tool to create custom shortcode templates and stylesheets.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Page Resources&lt;/strong&gt;: A more advanced method that I haven&amp;rsquo;t explored yet.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I hope this helps you successfully display images in your posts. If you encounter problems, check your image paths and clear your cache using &lt;code&gt;hugo --gc&lt;/code&gt;.&lt;/p&gt;
&lt;h1 id=&#34;clean-the-public-folder&#34;&gt;Clean The &lt;code&gt;public&lt;/code&gt; Folder&lt;/h1&gt;
&lt;p&gt;After testing many methods for inserting images, I accumulated many outdated pages in the &lt;code&gt;public&lt;/code&gt; folder. Rather than manually deleting them, I wanted an automatic solution. I found an elegant method from essesoul&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;: simply add one line to &lt;code&gt;hugo.toml&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-toml&#34; data-lang=&#34;toml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;cleanDestinationDir&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Finally, I&amp;rsquo;d like to thank the authors I referenced, especially Brain Build, who compiled helpful resources&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; about inserting images in Hugo.&lt;/p&gt;
&lt;div class=&#34;footnotes&#34; role=&#34;doc-endnotes&#34;&gt;
&lt;hr&gt;
&lt;ol&gt;
&lt;li id=&#34;fn:1&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://www.essesoul.top/posts/hugo-auto-clean/&#34;&gt;Hugo 自动清理 Public 目录下的文件&lt;/a&gt;&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;
&lt;/li&gt;
&lt;li id=&#34;fn:2&#34;&gt;
&lt;p&gt;&lt;a href=&#34;https://blog.aiwith.fun/posts/add-picture-in-hugo/&#34;&gt;How to add picture in Hugo&lt;/a&gt;&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;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Brew Install Local Files</title>
      <link>https://herding.github.io/posts/brew_install_local_files/</link>
      <pubDate>Sun, 09 Nov 2025 20:10:49 +0800</pubDate>
      
      <guid>https://herding.github.io/posts/brew_install_local_files/</guid>
      <description>&lt;h1 id=&#34;how-to-install-a-local-file-with-homebrew&#34;&gt;How to install a local file with Homebrew&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Find the cache location&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;brew --cache -s &amp;lt;your package name&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;For example, I want to install &lt;code&gt;dart-lang/dart/dart&lt;/code&gt; from &lt;code&gt;https://storage.googleapis.com/dart-archive/channels/stable/release/3.9.4/sdk/dartsdk-macos-arm64-release.zip&lt;/code&gt;, which may be inaccessible from within China. So I first downloaded it to my &lt;code&gt;Downloads&lt;/code&gt; folder, then I used the command above to find Homebrew&amp;rsquo;s cache directory for &lt;code&gt;dart&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Replace &lt;code&gt;&amp;lt;your package name&amp;gt;&lt;/code&gt; with the formula name (e.g. &lt;code&gt;dart-lang/dart/dart&lt;/code&gt;) and &lt;code&gt;&amp;lt;your file&amp;gt;&lt;/code&gt; with the downloaded file name (e.g. &lt;code&gt;dartsdk-macos-arm64-release.zip&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;By the way, if you want to run &lt;code&gt;dart pub get&lt;/code&gt; quickly, you need to add &lt;code&gt;export PUB_HOSTED_URL=&amp;quot;https://mirrors.tuna.tsinghua.edu.cn/dart-pub&amp;quot;&lt;/code&gt; to &lt;code&gt;~/.bashrc&lt;/code&gt; or &lt;code&gt;~/.zshrc&lt;/code&gt;.&lt;/p&gt;
&lt;ol start=&#34;2&#34;&gt;
&lt;li&gt;Move the local file&lt;/li&gt;
&lt;/ol&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;mv ~/Downloads/&amp;lt;your file&amp;gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;&lt;span class=&#34;k&#34;&gt;$(&lt;/span&gt;brew --cache -s &amp;lt;your package name&amp;gt;&lt;span class=&#34;k&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Reinstall&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If your Homebrew version is greater than or equal to 4.0, you may need to add the following to &lt;code&gt;~/.bash_profile&lt;/code&gt; or &lt;code&gt;~/.zprofile&lt;/code&gt; before installing:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;export HOMEBREW_NO_INSTALL_FROM_API=1&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Then run:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;brew install &amp;lt;your package&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
  </channel>
</rss>
