<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Images on nocturne</title><link>https://tiennm99.github.io/nocturne/tags/hinh-anh/</link><description>Recent content in Images on nocturne</description><generator>Hugo</generator><language>en</language><lastBuildDate>Fri, 12 Jun 2026 20:00:00 +0700</lastBuildDate><atom:link href="https://tiennm99.github.io/nocturne/tags/hinh-anh/index.xml" rel="self" type="application/rss+xml"/><item><title>Images in a post</title><link>https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/</link><pubDate>Fri, 12 Jun 2026 20:00:00 +0700</pubDate><guid>https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/</guid><description>&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/dem-thanh-pho.jpg" alt="A horizontal gradient from near-black navy on the left to pale sky blue on the right, like a city sky at dusk"&gt;&lt;p&gt;That is &lt;code&gt;dem-thanh-pho.jpg&lt;/code&gt; (1600×900), stored in the same folder as the post. As the first image, right at the top, it is likely the largest thing on screen when the page appears, so the theme loads it straight away with &lt;code&gt;loading=&amp;quot;eager&amp;quot;&lt;/code&gt; and &lt;code&gt;fetchpriority=&amp;quot;high&amp;quot;&lt;/code&gt;. Every image after it loads lazily, as the reader scrolls near.&lt;/p&gt;
&lt;p&gt;Hugo knows the image&amp;rsquo;s size, so the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; carries &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;height&lt;/code&gt;: the browser reserves the space and the text does not jump when the image arrives. It also gets a &lt;code&gt;srcset&lt;/code&gt; of WebP copies 480, 960, 1440 and 1600 pixels wide, and the browser picks the one that fits the screen. Click the image to open the original file.&lt;/p&gt;
&lt;p&gt;The same image is set as &lt;code&gt;cover.image&lt;/code&gt; in the front matter. The theme does not draw a cover above the post; it uses the image for the Open Graph card shown when someone pastes the post&amp;rsquo;s link into a social network or a chat app.&lt;/p&gt;
&lt;h2 id="images-in-the-bundle"&gt;Images in the bundle&lt;/h2&gt;&lt;p&gt;An image next to &lt;code&gt;index.md&lt;/code&gt; is a page resource, referenced by its file name alone. JPEG, PNG and WebP files get resized copies at build time; SVG and GIF are served as they are.&lt;/p&gt;
&lt;h3 id="a-png-with-attributes"&gt;A PNG with attributes&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/hoa-van.png" alt="A 16:9 frame whose background shades from navy through blue to teal, with a charcoal square in the middle" class="wide" id="hoa-van"&gt;&lt;p&gt;&lt;code&gt;hoa-van.png&lt;/code&gt; (1200×675) gets the same treatment as the JPG: a size and a WebP &lt;code&gt;srcset&lt;/code&gt;. The &lt;code&gt;{#hoa-van .wide}&lt;/code&gt; line right below it is a Markdown attribute that puts an &lt;code&gt;id&lt;/code&gt; and a class on the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; itself. That lets you &lt;a href="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/#hoa-van"&gt;link to this exact image&lt;/a&gt; or style the &lt;code&gt;wide&lt;/code&gt; class in your own CSS.&lt;/p&gt;
&lt;h3 id="a-webp-with-a-caption"&gt;A WebP with a caption&lt;/h3&gt;&lt;figure&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/binh-minh.webp" alt="A diagonal gradient from dark moss green in the bottom-left corner to pale teal in the top right"&gt;&lt;figcaption&gt;Sunrise: this image has a title in quotes, so it is wrapped in a figure and the title becomes this caption.&lt;/figcaption&gt;&lt;/figure&gt;&lt;p&gt;An image that stands alone in its paragraph and has a title becomes a &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; with a &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt;. The alt text describes what is in the picture for screen reader users, while the caption is a remark everyone sees; the two should complement each other, not repeat each other.&lt;/p&gt;
&lt;h3 id="a-gif-served-as-is"&gt;A GIF served as is&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/song.gif" alt="Vertical blue bands, from pale sky blue to near-black, sliding sideways in a loop"&gt;&lt;p&gt;Hugo cannot resize a GIF and keep it moving, so &lt;code&gt;song.gif&lt;/code&gt; is served exactly as stored, with no &lt;code&gt;srcset&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt; or &lt;code&gt;height&lt;/code&gt;. It still loads lazily like every other image.&lt;/p&gt;
&lt;h2 id="an-image-inside-a-link"&gt;An image inside a link&lt;/h2&gt;&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Compass" rel="noopener noreferrer"&gt;&lt;img src="https://tiennm99.github.io/nocturne/2026/06/12/hinh-anh/la-ban.svg" alt="A round compass face on a dark background with a blue rim and a blue-and-white diamond needle pointing straight up"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;la-ban.svg&lt;/code&gt; is a vector image, so it stays as is: it is sharp at any size and needs no resized copies. It already sits inside a link to Wikipedia, so the theme does not wrap it in a second link to the original file — an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; inside an &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; is invalid HTML.&lt;/p&gt;
&lt;h2 id="an-image-from-the-static-folder"&gt;An image from the static folder&lt;/h2&gt;&lt;img src="https://tiennm99.github.io/nocturne/img/tinh-tu-static.png" alt="A broadcast test card: six vertical bars in red, green, yellow, blue, magenta and cyan, crossed by a diagonal rainbow streak"&gt;&lt;p&gt;This file lives at &lt;code&gt;static/img/tinh-tu-static.png&lt;/code&gt; and is referenced with the root-relative path &lt;code&gt;/img/tinh-tu-static.png&lt;/code&gt;. The demo runs under &lt;code&gt;/nocturne/&lt;/code&gt; on GitHub Pages, so the theme adds the base path and the image loads from &lt;code&gt;/nocturne/img/tinh-tu-static.png&lt;/code&gt;. Change &lt;code&gt;baseURL&lt;/code&gt; and the image still shows up, no edits to the post. Files in &lt;code&gt;static/&lt;/code&gt; are not page resources, so there are no resized copies.&lt;/p&gt;
&lt;h2 id="images-from-another-host"&gt;Images from another host&lt;/h2&gt;&lt;img src="https://tiennm99.github.io/nocturne/img/tinh-tu-static.png" alt="The same six-bar test card, this time loaded from a full URL"&gt;&lt;p&gt;A full URL starting with &lt;code&gt;https://&lt;/code&gt; is left untouched. The theme does not download remote images at build time, so it does not know their size.&lt;/p&gt;
&lt;h3 id="a-gif-that-becomes-a-video"&gt;A GIF that becomes a video&lt;/h3&gt;&lt;img src="https://tiennm99.github.io/nocturne/media/the-gioi-song.gif" alt="Diagonal blue bands, from pale sky blue to almost black, sweeping across the frame in a loop"&gt;&lt;p&gt;To handle remote images, a site can add a &lt;code&gt;layouts/_partials/image/remote.html&lt;/code&gt; partial; the theme calls it for every full URL. The demo&amp;rsquo;s partial knows one case only: a GIF in the &lt;code&gt;/media/&lt;/code&gt; folder that has an MP4 file of the same name. That image is swapped for a muted, looping &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; that loads only when you scroll near it and plays only while it is on screen. The MP4 here weighs about 4 KB against the GIF&amp;rsquo;s 23 KB. With JavaScript turned off, the browser shows the original GIF.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://github.com/tiennm99/nocturne/blob/main/docs/customization.md#remote-images" rel="noopener noreferrer"&gt;theme&amp;rsquo;s customization guide&lt;/a&gt; explains how to write this partial.&lt;/p&gt;</description></item></channel></rss>