<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xml:base="https://bjorn.now/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Web-Dev on bjorn.now</title><link>https://bjorn.now/tags/web-dev/</link><description>Recent content in Web-Dev on bjorn.now</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 02 Dec 2026 12:44:43 +0100</lastBuildDate><atom:link href="https://bjorn.now/tags/web-dev/feed.xml" rel="self" type="application/rss+xml"/><item><title>How to disable the cache in Safari</title><link>https://bjorn.now/til/2026-12-02-how-to-disable-the-cache-in-safari/?utm_medium=feed</link><pubDate>Wed, 02 Dec 2026 12:44:43 +0100</pubDate><guid>https://bjorn.now/til/2026-12-02-how-to-disable-the-cache-in-safari/</guid><description>To disable cache while developing on Safari:
Open the Web Inspector Go to the Network tab Check the Disable Caches checkbox in the top-right corner This will then be used only when the Web Inspector is open, so caching works normally when it’s closed.
To force a reload when the Web Inspector is closed, hit Command-Option-R.</description><content:encoded><![CDATA[<p>To disable cache while developing on Safari:</p>
<ol>
<li>Open the <code>Web Inspector</code></li>
<li>Go to the <code>Network</code> tab</li>
<li>Check the <code>Disable Caches</code> checkbox in the top-right corner</li>
</ol>
<p>This will then be used <strong>only when</strong> the Web Inspector is open, so caching works normally when it&rsquo;s closed.</p>
<p>To force a reload when the Web Inspector is closed, hit <code>Command-Option-R</code>.</p>
]]></content:encoded></item><item><title>Hugo's resources.Get only finds files in assets/, not static/</title><link>https://bjorn.now/til/2025-10-08-hugos-resources-get-only-finds-files-in-assets-not-static/?utm_medium=feed</link><pubDate>Wed, 08 Oct 2025 15:14:34 +0200</pubDate><guid>https://bjorn.now/til/2025-10-08-hugos-resources-get-only-finds-files-in-assets-not-static/</guid><description>Hugo’s resources.Get only finds files in assets/, not static/.
I kept my assets/resources in static/ and didn’t get why I always had to write /absolute/urls and use hope as a strategy, when I moved them into assets/ I could look up all my assets.</description><content:encoded><![CDATA[<p>Hugo&rsquo;s <code>resources.Get</code> only finds files in <code>assets/</code>, not <code>static/</code>.</p>
<p>I kept my assets/resources in <code>static/</code> and didn&rsquo;t get why I always had to write <code>/absolute/urls</code> and use hope as a strategy,
when I moved them into <code>assets/</code> I could look up all my assets.</p>
<p>The below would fail because it couldn&rsquo;t find the asset:</p>
<div class=" copy-enabled">
  <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-plain" data-lang="plain"><span class="line"><span class="cl">{{ with resources.Get &#34;/author/bjorn.jpg&#34; }}
</span></span><span class="line"><span class="cl">  &lt;img src=&#34;{{ .RelPermalink }}&#34; alt=&#34;Björn Andersson&#34;&gt;
</span></span><span class="line"><span class="cl">{{ end }}</span></span></code></pre></div>
</div>
<p>Hugo has global assets accessed through <code>resources.Get</code> which <strong>only</strong> looks up in <code>assets/</code>.
Then page assets that you get through <code>.Page.Resources.Get</code> instead, which I haven&rsquo;t used yet.</p>
<p>If you want to use both, then do like the <a href="https://github.com/gohugoio/hugo/blob/4414ef73f3cd490caf93e0d50a6102db9ab28318/tpl/tplimpl/embedded/templates/_shortcodes/figure.html#L9C5-L11C16">figure shortcode</a> and do it in an or:</p>
<div class=" copy-enabled">
  <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-plain" data-lang="plain"><span class="line"><span class="cl">{{- with or (.Page.Resources.Get $u.Path) 
</span></span><span class="line"><span class="cl">            (resources.Get $u.Path) -}}
</span></span><span class="line"><span class="cl">{{- $src = .RelPermalink -}}
</span></span><span class="line"><span class="cl">{{- end -}}</span></span></code></pre></div>
</div>]]></content:encoded></item><item><title>Use :focus-visible instead of :focus, because it will only show when helpful</title><link>https://bjorn.now/til/2025-09-30-focus-visible-instead-of-focus-to-avoid-extra-styling/?utm_medium=feed</link><pubDate>Tue, 30 Sep 2025 13:09:33 +0200</pubDate><guid>https://bjorn.now/til/2025-09-30-focus-visible-instead-of-focus-to-avoid-extra-styling/</guid><description>Use :focus-visible instead of :focus, because it will only show when helpful.
:focus-visible only shows focus styling when the browser determines keyboard navigation is being used, unlike :focus which triggers on all interactions including mouse clicks.</description><content:encoded><![CDATA[<p>Use <code>:focus-visible</code> instead of <code>:focus</code>, because it will <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible#focus_vs_focus-visible">only show when helpful.</a></p>
<p><code>:focus-visible</code> only shows focus styling when the browser determines keyboard navigation is being used, unlike <code>:focus</code> which triggers on all interactions including mouse clicks.</p>
<div class=" copy-enabled">
  <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-css" data-lang="css"><span class="line"><span class="cl"><span class="nt">button</span><span class="p">:</span><span class="nd">focus-visible</span> <span class="p">{</span> <span class="k">outline</span><span class="p">:</span> <span class="mi">2</span><span class="kt">px</span> <span class="kc">solid</span> <span class="kc">blue</span><span class="p">;</span> <span class="p">}</span></span></span></code></pre></div>
</div>
<p>This prevents the &ldquo;clicked button stays highlighted&rdquo; problem while preserving accessibility for keyboard users. <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible#focus_vs_focus-visible">Full browser logic on MDN</a>.</p>]]></content:encoded></item><item><title>Link rel="canonical" is like a correlation ID</title><link>https://bjorn.now/til/2025-08-02-the-link-rel-href-is-a-bit-like-a-correlation-id-between-services-and-i-need-also-to-have-it-on-my-canonical-page/?utm_medium=feed</link><pubDate>Sat, 02 Aug 2025 09:37:29 +0800</pubDate><guid>https://bjorn.now/til/2025-08-02-the-link-rel-href-is-a-bit-like-a-correlation-id-between-services-and-i-need-also-to-have-it-on-my-canonical-page/</guid><description>The &lt;link rel="canonical" href="…"&gt; is a bit like a correlation ID between services and I need also to have it on my canonical page, because if someone sends it with ?utm_source=foo it could be a different page than the one without the query string.</description><content:encoded><![CDATA[<p>The <code>&lt;link rel=&quot;canonical&quot; href=&quot;…&quot;&gt;</code> is a bit like a correlation ID between services and I need also to have it on my canonical page, because if someone sends it with <code>?utm_source=foo</code> it <strong>could</strong> be a different page than the one without the query string.</p>
]]></content:encoded></item></channel></rss>