<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Dev Mind]]></title><description><![CDATA[I am a developer willing to share my thoughts on things I am working with through this blog.]]></description><link>https://devmind.mohessaid.com</link><generator>RSS for Node</generator><lastBuildDate>Wed, 29 Apr 2026 20:33:31 GMT</lastBuildDate><atom:link href="https://devmind.mohessaid.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Host Hugo in Vercel]]></title><description><![CDATA[I decided to go with Hugo to build my personal website. The only thing I based my choice on was the build time. I thought Hugo was in the same league as Astro when it comes to content management perks, but it isn't quite there yet. Or, I can say it h...]]></description><link>https://devmind.mohessaid.com/how-to-host-hugo-in-vercel</link><guid isPermaLink="true">https://devmind.mohessaid.com/how-to-host-hugo-in-vercel</guid><category><![CDATA[Hugo]]></category><category><![CDATA[Vercel]]></category><category><![CDATA[build]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Mohammed Essaid MEZERREG]]></dc:creator><pubDate>Thu, 28 Nov 2024 10:26:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1732782217038/c6cc512c-a35a-4e15-a8dd-b114b6f436fb.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I decided to go with <a target="_blank" href="https://gohugo.io">Hugo</a> to build my personal <a target="_blank" href="https://mohessaid.com">website</a>. The only thing I based my choice on was the build time. I thought Hugo was in the same league as <a target="_blank" href="https://astro.new">Astro</a> when it comes to content management perks, but it isn't quite there yet. Or, I can say it has its own path since it's older than most of the other static site generators I've encountered. Moreover, it's a Go application, which is another important factor to consider when evaluating technology choices.</p>
<h2 id="heading-what-can-be-added">What Can Be Added!</h2>
<p>Yes, it's possible to extend Hugo's functionality. You can add missing features through modules that modify the build process. For example, I was missing MDX support in Hugo. I can address this through a module that renders MDX at build time. I haven't tried it myself, but it seems possible.
I can also potentially add a parallel building pipeline—if we can call it that. This might involve using tools like Vite, Turbo, or Webpack. However, this approach would likely complicate the build process and potentially slow down Hugo's main building mechanism. These integrations have been used to incorporate Tailwind and other frontend libraries. Interestingly, if you look at Hugo's upcoming features, you'll see plans for integrating Tailwind and other technologies.</p>
<h2 id="heading-building-on-vercel">Building on Vercel</h2>
<p>I used some third-party Hugo tools, specifically <a target="_blank" href="https://hugomods.com">HugoMods</a>. The <a target="_blank" href="https://icons.hugomods.com">icons module</a> caught my attention because I wanted to add icons to my website without importing an entire font. While searching, the Icons module was the first thing that appeared. It offers a variety of icon vendors, including Bootstrap, Font Awesome, Feather icons, and more.
Locally, everything worked perfectly. However, after pushing my changes, nothing seemed to change. Upon checking the build page in Vercel, I noticed...</p>
<pre><code class="lang-bash">[12:10:48.021] Running build <span class="hljs-keyword">in</span> Washington, D.C., USA (East) – iad1
[12:10:48.210] Cloning github.com/mohessaid/mohessaid (Branch: main, Commit: eaeecd1)
[12:10:48.449] Cloning completed: 238.727ms
[12:10:49.038] Restored build cache from previous deployment (5i5sCdjnY3KZXgGBqbqfgJUjrwYB)
[12:10:49.132] Running <span class="hljs-string">"vercel build"</span>
[12:10:49.714] Vercel CLI 39.0.2
[12:10:50.440] Total <span class="hljs-keyword">in</span> 3 ms
[12:10:50.441] Error: failed to load modules: failed to download modules: binary with name <span class="hljs-string">"go"</span> not found <span class="hljs-keyword">in</span> PATH
[12:10:50.446] Error: Command <span class="hljs-string">"hugo --gc"</span> exited with 1
[12:10:50.625]
</code></pre>
<p>When Hugo attempted to install the modules needed for the build, it couldn't find the Go binaries. I sought help from Claude and GPT, hoping for a quick solution, but they were unable to provide direct assistance. I had to guide them through each step, and eventually, I lost hope in their ability to help me.
I had even used Claude for a solution that was nearly successful, if not for the limitations in the Vercel input fields.</p>
<h2 id="heading-what-worked">What Worked?</h2>
<p>I navigated to the settings page of my website in the Vercel dashboard. In the "Environment Variables" tab, I added a variable named "HUGO_VERSION" and set its value to the latest available version of Hugo.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732568193384/43a632b4-0c36-4aed-bd2c-6c020b79bd83.png" alt="Hugo Version Environment Variable in Vercel." class="image--center mx-auto" /></p>
<p>In the "General" tab, select Hugo as the framework preset. Then override the build command with the following:</p>
<pre><code class="lang-bash">curl -L https://go.dev/dl/go1.22.2.linux-amd64.tar.gz -o go1.22.2.linux-amd64.tar.gz &amp;&amp; tar -C /usr/<span class="hljs-built_in">local</span> -xzf go1.22.2.linux-amd64.tar.gz &amp;&amp; <span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$PATH</span>:/usr/<span class="hljs-built_in">local</span>/go/bin &amp;&amp; go env GOTPATH  &amp;&amp;  hugo --gc --minify
</code></pre>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732568221495/e3c7a453-3d11-4238-9111-f5b61d79eea6.png" alt="General settings in Vercel dashboard" class="image--center mx-auto" /></p>
<blockquote>
<p>Note: I'm using Go version 1.22.2, which is the latest at the time of writing. You can modify the version to match your specific requirements.</p>
</blockquote>
<h2 id="heading-why-build-command">Why Build Command?</h2>
<p>I understand your skepticism. Like you, I thought I had a clever solution. Initially, I attempted to install Go in the Install Command field, but it failed miserably. Vercel's build process couldn't locate the binaries, despite my exhaustive troubleshooting.
After exploring countless potential solutions without success, I stumbled upon a GitHub issue where someone had placed their entire installation process directly in the build field. Replicating their approach, I finally achieved success. At this point, the solution speaks for itself.
Attempting to place these steps in the install command field will likely result in errors.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732568683988/ae735cdb-8cc6-4211-8b20-a0bdef66b3bd.png" alt="Build logs for using install command" class="image--center mx-auto" /></p>
<p>Or this one</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1732568781503/9516e5b8-b6bd-4b2d-bf5d-a9e84d11a1a4.png" alt="Build logs for using install command" class="image--center mx-auto" /></p>
<p>Installing Amazon Linux Extras won't solve the Go installation challenge. The version of Go available through this method is significantly outdated. I tested this approach thoroughly and encountered consistent failures. I attempted to use both <code>yum</code> and <code>dnf</code> package managers in the install command, but neither method successfully resolved the Go binary issue.</p>
<hr />
<p>Finally, I shared this post across different platforms to test which one of them get first in search results. I was willing to do this months ago. However, I couldn't the right post for it. You can follow the experiment from <a target="_blank" href="https://dub.sh/ZIRzyDy">here</a>.</p>
]]></content:encoded></item><item><title><![CDATA[Configure Xdebug with Lando and VS Code]]></title><description><![CDATA[I am documenting this to avoid wasting time on this issue. You can find all the details from Lando's official documentation in the following link.
I have been using Ubuntu for the last six years or so. As you may have guessed, this tutorial will assu...]]></description><link>https://devmind.mohessaid.com/configure-xdebug-with-lando-and-vs-code</link><guid isPermaLink="true">https://devmind.mohessaid.com/configure-xdebug-with-lando-and-vs-code</guid><category><![CDATA[XDebug]]></category><category><![CDATA[PHP]]></category><category><![CDATA[lando]]></category><dc:creator><![CDATA[Mohammed Essaid MEZERREG]]></dc:creator><pubDate>Wed, 12 Jul 2023 08:22:19 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1689161043359/d762758b-d691-49e5-93f4-a27f2ee34a27.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I am documenting this to avoid wasting time on this issue. You can find all the details from Lando's official documentation in the following <a target="_blank" href="https://docs.lando.dev/guides/lando-with-vscode.html">link</a>.</p>
<p>I have been using Ubuntu for the last six years or so. As you may have guessed, this tutorial will assume you are using the same system or something similar, like WSL in Windows.<br />To use Xdebug in Lando, as mentioned in the documentation, you must include this line under the configuration of your app server:</p>
<pre><code class="lang-yaml"><span class="hljs-attr">config:</span>
    <span class="hljs-attr">xdebug:</span> <span class="hljs-literal">true</span>
</code></pre>
<p>In the documentation after this step, you have to set up your <code>launch.json</code> file in VS code.</p>
<pre><code class="lang-json">{
  <span class="hljs-attr">"version"</span>: <span class="hljs-string">"0.2.0"</span>,
  <span class="hljs-attr">"configurations"</span>: [
    {
      <span class="hljs-attr">"name"</span>: <span class="hljs-string">"Listen for XDebug"</span>,
      <span class="hljs-attr">"type"</span>: <span class="hljs-string">"php"</span>,
      <span class="hljs-attr">"request"</span>: <span class="hljs-string">"launch"</span>,
      <span class="hljs-attr">"port"</span>: <span class="hljs-number">9003</span>,
      <span class="hljs-attr">"pathMappings"</span>: {
        <span class="hljs-attr">"/app/"</span>: <span class="hljs-string">"${workspaceFolder}/"</span>,
      }
    }
  ]
}
</code></pre>
<p>Also, in the documentation, you have to run. <code>lando rebuild -y</code> So the changes take place in your Lando image. However, most of the time, you will run to issue regarding the listening port. This was mentioned at the end of the documentation under the known issues.</p>
<p>To fix it, you have to add a new rule to the <code>iptables</code> and allow the target port.</p>
<pre><code class="lang-bash">sudo iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 9003 -j ACCEPT
</code></pre>
<p>You have to restart your Lando workspace to get things working.</p>
]]></content:encoded></item><item><title><![CDATA[How to create a docker image and host it on Github Packages]]></title><description><![CDATA[Github packages are relatively new compared to Docker Hub. It includes lots of services like NPM packages, Nuget packages, and so on. In this article, we are going to use the containers service. The pricing for docker image hosting is excellent compa...]]></description><link>https://devmind.mohessaid.com/how-to-create-a-docker-image-and-host-it-on-github-packages</link><guid isPermaLink="true">https://devmind.mohessaid.com/how-to-create-a-docker-image-and-host-it-on-github-packages</guid><category><![CDATA[Docker]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Mohammed Essaid MEZERREG]]></dc:creator><pubDate>Sat, 23 Oct 2021 20:28:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1635020808251/_s7at8TA_.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Github packages are relatively new compared to Docker Hub. It includes lots of services like NPM packages, Nuget packages, and so on. In this article, we are going to use the containers service. The pricing for docker image hosting is excellent compared to other providers. Bear in mind that this pricing concerns private repositories only, as the service is totally free for public repositories.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635017786972/Lvvn5lF4c.png" alt="image.png" /></p>
<p>For starters, you can take any image you have from your archive and follow this tutorial. If you don't have any, you can use the snippet below, which says, "Hello world!" To host your image in Github packages, you have to tag it with the full path to your image in Github as follow</p>
<pre><code class="lang-sh">docker tag hello-world-alpine:latest ghcr.io/mohessaid/hello-world-alpine:latest
</code></pre>
<p>Of course, you have to build the image first, and also, you can name it directly with the Github full name if you find it appropriate. </p>
<pre><code class="lang-sh">docker build --no-cache -t hello-world-alpine .
</code></pre>
<p>The dot at the end refers to the current working directory which contains in our example the following Dockerfile</p>
<pre><code class="lang-yaml"><span class="hljs-string">FROM</span> <span class="hljs-string">alpine:3</span>

<span class="hljs-string">CMD</span> [<span class="hljs-string">"echo"</span>, <span class="hljs-string">"Hello World from Github and Hashnode!"</span>]
</code></pre>
<p>After that, you have to push the image, but you have to log in with your Github account before you do so. Like you log into your docker hub account from the terminal, you do it with Github. The sole difference is in the password. With Github, you need to create a personal token with the privileges of writing to your packages and use it as a password.</p>
<ol>
<li>From your profile menu go to settings</li>
<li>Go to Developer settings</li>
<li>Go to Personal access tokens</li>
<li>Generate a new token with the following permissions
 <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1635018365826/YOvkj06QQ.png" alt="image.png" /></li>
<li>Set the expiration period and a name and hit Generate token.</li>
</ol>
<p>You have one chance to copy your new token and use it to log in. As the Github documentation mentions it is a good practice to save the token in an environment variable and use it as follows to log in.</p>
<pre><code class="lang-sh"><span class="hljs-built_in">echo</span> <span class="hljs-variable">$PAT</span> | docker login ghcr.io --username phanatic --password-stdin
</code></pre>
<p>If you don't know how to create this variable just use copy-paste the following command.</p>
<pre><code class="lang-sh"><span class="hljs-built_in">export</span> PAT=you token here
</code></pre>
<p>Finally, push your image and enjoy using it inside your Github actions or share it with your friends or community.</p>
<pre><code class="lang-sh">docker push ghcr.io/mohessaid/hello-world-alpine:latest
</code></pre>
<h1 id="associate-your-image-with-a-repository">Associate your image with a repository</h1>
<p>You can associate your image with a repository using the label in your docker file or from Github. The label should have the following syntax.</p>
<pre><code>LABEL org.opencontainers.image.source=https:<span class="hljs-comment">//github.com/mohessaid/hello-world-alpine</span>
</code></pre><p>The source or the URL refers to your repository.</p>
]]></content:encoded></item><item><title><![CDATA[Copy from HTML input field to Clipboard]]></title><description><![CDATA[You can find this answer in the Mozilla Developer Network or MDN on the clipboard API. It is very easy and straight forward to use and implement. However, I decided to write this short bit to mention something that got me in a loop of wonders and cos...]]></description><link>https://devmind.mohessaid.com/copy-from-html-input-field-to-clipboard</link><guid isPermaLink="true">https://devmind.mohessaid.com/copy-from-html-input-field-to-clipboard</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[HTML5]]></category><dc:creator><![CDATA[Mohammed Essaid MEZERREG]]></dc:creator><pubDate>Wed, 03 Feb 2021 20:51:13 GMT</pubDate><content:encoded><![CDATA[<p>You can find this answer in the Mozilla Developer Network or MDN on the clipboard API. It is very easy and straight forward to use and implement. However, I decided to write this short bit to mention something that got me in a loop of wonders and cost me time and delayed one of my hotfixes to a certain project.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://codepen.io/mohessaid/embed/BaQojjm?height=265&amp;theme-id=light&amp;default-tab=result">https://codepen.io/mohessaid/embed/BaQojjm?height=265&amp;theme-id=light&amp;default-tab=result</a></div>
<p>In the code above you can test the clipboard API using Vanilla JavaScript. Moreover, you have options to disable the input field or make it read-only. When you test it you will notice that disabling the input interferes with the clipboard API and prevent it from getting the content of the input. I wasn't aware of that until I got stuck in the loop of wonders I mentioned before.</p>
]]></content:encoded></item></channel></rss>