<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:content="http://purl.org/rss/1.0/modules/content/"
  xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Content - Pocket Hugo</title>
    <link>https://theme.leftn.com/zh-cn/tags/content/</link>
    <description>Content</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>zh-cn</language>
    <lastBuildDate>Mon, 20 Apr 2026 02:51:39 &#43;0000</lastBuildDate>
    <atom:link href="https://theme.leftn.com/zh-cn/tags/content/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>短代码演示</title>
      <link>https://theme.leftn.com/zh-cn/article/shortcodes-demo/</link>
      <pubDate>Fri, 06 Mar 2026 01:00:00 &#43;0000</pubDate>
      <guid>https://theme.leftn.com/zh-cn/article/shortcodes-demo/</guid>
      <description>一篇把多个实用短代码集中展示在一起的示例页面，适合内容密集型 Hugo 站点。</description>
      <content:encoded><![CDATA[<p>这篇页面汇总了几个很适合内容型 Hugo 主题使用的实用短代码。它们都尽量保持简单、容易复制，适合随笔、笔记和文档类页面。</p>
<h2 id="fold">Fold</h2>
<p>当某一段内容不想一开始就占太多纵向空间时，可以使用 <code>fold</code>。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; fold &#34;Why this shortcode exists&#34; &gt;}}
</span></span><span class="line"><span class="cl">This hidden block is rendered inside a native `&lt;details&gt;` element.
</span></span><span class="line"><span class="cl">{{&lt; /fold &gt;}}</span></span></code></pre></div><details>
    <summary>Why this shortcode exists</summary>
    这个隐藏区块会被渲染成原生的 <code>&lt;details&gt;</code> 元素，因此不依赖 JavaScript，也很适合长文阅读场景。
</details>

<h2 id="note">Note</h2>
<p><code>note</code> 适合用来放提示、警告或旁注。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; note type=&#34;info&#34; title=&#34;Content-first&#34; &gt;}}
</span></span><span class="line"><span class="cl">Pocket Hugo Theme keeps callouts readable without making them look like app UI.
</span></span><span class="line"><span class="cl">{{&lt; /note &gt;}}</span></span></code></pre></div><div class="shortcode-note shortcode-note--info"><div class="shortcode-note__title">Content-first</div><div class="shortcode-note__body">
    Pocket Hugo Theme 会让这类提示块保持清晰易读，而不会看起来像一套应用界面组件。
  </div>
</div>

<div class="shortcode-note shortcode-note--tip"><div class="shortcode-note__title">Tip</div><div class="shortcode-note__body">
    这类短代码很适合教程、更新记录和写作指南。
  </div>
</div>

<div class="shortcode-note shortcode-note--warn"><div class="shortcode-note__title">Experimental</div><div class="shortcode-note__body">
    如果你要新增自定义短代码，尽量保持它们足够小、足够容易理解。读者不应该先研究布局，才能开始阅读内容。
  </div>
</div>

<h2 id="badge">Badge</h2>
<p>Badge 适合在段落中放置简短的状态标签。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; badge &#34;Stable&#34; &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; badge text=&#34;Optional&#34; type=&#34;info&#34; &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; badge text=&#34;Experimental&#34; type=&#34;warn&#34; &gt;}}</span></span></code></pre></div><p><span class="shortcode-badge shortcode-badge--default">Stable</span>

<span class="shortcode-badge shortcode-badge--info">Optional</span>

<span class="shortcode-badge shortcode-badge--warn">Experimental</span>
</p>
<h2 id="button">Button</h2>
<p>当你想要比普通文本链接更醒目的行内跳转入口时，可以使用 <code>button</code>。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; button href=&#34;https://theme.leftn.com/guide/&#34; label=&#34;Open the Guide&#34; &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; button href=&#34;https://theme.leftn.com/links/&#34; label=&#34;Browse Links&#34; style=&#34;ghost&#34; &gt;}}</span></span></code></pre></div><p><a class="shortcode-button shortcode-button--primary" href="/guide/">Open the Guide</a>

<a class="shortcode-button shortcode-button--ghost" href="/links/">Browse Links</a>
</p>
<h2 id="video-and-audio">Video and audio</h2>
<p>这些短代码可以让常见的媒体嵌入方式和主题整体风格保持一致。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; video src=&#34;https://theme.leftn.com/media/demo.mp4&#34; title=&#34;Local video&#34; &gt;}}Caption{{&lt; /video &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; audio src=&#34;https://theme.leftn.com/media/demo.mp3&#34; title=&#34;Audio clip&#34; &gt;}}Caption{{&lt; /audio &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; youtube id=&#34;rdwz7QiG0lk&#34; &gt;}}YouTube embed{{&lt; /youtube &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; bilibili bvid=&#34;BV1xx411c7mu&#34; &gt;}}Bilibili embed{{&lt; /bilibili &gt;}}</span></span></code></pre></div><figure class="shortcode-media shortcode-media--video">
  <video
    controls
    preload="metadata"
    title="HTML5 video"
    
    
    
    
    playsinline>
    <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" />
  </video>
  <figcaption>一个普通的 HTML5 视频包装，沿用主题默认的圆角和留白。</figcaption>
</figure>

<figure class="shortcode-media shortcode-media--audio">
  <div class="shortcode-audio__title">HTML5 audio</div>
  <audio controls preload="metadata">
    <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3">
  </audio>
  <figcaption>一个风格统一的音频播放器，适合短音频、播客片段或语音笔记。</figcaption>
</figure>

<figure class="shortcode-media shortcode-media--embed">
  <div class="shortcode-embed">
    <iframe
      src="https://www.youtube-nocookie.com/embed/rdwz7QiG0lk"
      title="YouTube video"
      loading="lazy"
      referrerpolicy="strict-origin-when-cross-origin"
      allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
      allowfullscreen>
    </iframe>
  </div>
  <figcaption>使用同样媒体外壳包裹的 YouTube 嵌入。</figcaption>
</figure>

<figure class="shortcode-media shortcode-media--embed">
  <div class="shortcode-embed">
    <iframe
      src="https://player.bilibili.com/player.html?bvid=BV1xx411c7mu&page=1"
      title="Bilibili video"
      loading="lazy"
      scrolling="no"
      frameborder="0"
      allowfullscreen>
    </iframe>
  </div>
  <figcaption>使用相同响应式容器的 Bilibili 嵌入。</figcaption>
</figure>

<h2 id="timeline">Timeline</h2>
<p>当你想表达一个过程、更新记录或时间序列时，可以使用 <code>timeline</code>。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; timeline &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; timeline-item date=&#34;2026-01&#34; title=&#34;Planning&#34; &gt;}}Outline the scope.{{&lt; /timeline-item &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; timeline-item date=&#34;2026-02&#34; title=&#34;Build&#34; &gt;}}Ship the first version.{{&lt; /timeline-item &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; /timeline &gt;}}</span></span></code></pre></div><div class="shortcode-timeline">
  
<div class="shortcode-timeline__item">
  <div class="shortcode-timeline__rail"></div>
  <div class="shortcode-timeline__content">
    <div class="shortcode-timeline__date">2026-01</div>
    <div class="shortcode-timeline__title">Planning</div>
    <div class="shortcode-timeline__body">先勾勒功能的第一版范围，并让数据格式保持精简。</div>
  </div>
</div>

<div class="shortcode-timeline__item">
  <div class="shortcode-timeline__rail"></div>
  <div class="shortcode-timeline__content">
    <div class="shortcode-timeline__date">2026-02</div>
    <div class="shortcode-timeline__title">Build</div>
    <div class="shortcode-timeline__body">做出一个简单实现，更偏向长文内容而不是应用式界面。</div>
  </div>
</div>

<div class="shortcode-timeline__item">
  <div class="shortcode-timeline__rail"></div>
  <div class="shortcode-timeline__content">
    <div class="shortcode-timeline__date">2026-03</div>
    <div class="shortcode-timeline__title">Polish</div>
    <div class="shortcode-timeline__body">继续打磨文案、留白和多语言示例。</div>
  </div>
</div>


</div>

<h2 id="columns">Columns</h2>
<p>当两组内容需要并排比较时，可以使用 <code>columns</code>。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; columns &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; column &gt;}}Left side{{&lt; /column &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; column &gt;}}Right side{{&lt; /column &gt;}}
</span></span><span class="line"><span class="cl">{{&lt; /columns &gt;}}</span></span></code></pre></div><div class="shortcode-columns">
  
<div class="shortcode-columns__item shortcode-columns__item--1">
  <h3 id="better-for">Better for</h3>
<ul>
<li>简短对比</li>
<li>功能摘要</li>
<li>前后变化说明</li>
</ul>

</div>

<div class="shortcode-columns__item shortcode-columns__item--1">
  <h3 id="avoid-for">Avoid for</h3>
<ul>
<li>很长的文章段落</li>
<li>过深的嵌套列表</li>
<li>必须线性阅读的内容</li>
</ul>

</div>


</div>

<h2 id="gallery">Gallery</h2>
<p>当一篇文章里需要一个紧凑的图片网格，而你又不想手写多张 Markdown 图片块时，可以使用 <code>gallery</code>。</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">{{&lt; gallery pattern=&#34;sample*.webp&#34; columns=&#34;3&#34; &gt;}}</span></span></code></pre></div><p>这个短代码会读取当前页面 bundle 中匹配的图片文件，把它们渲染成响应式相册网格，并在点击时复用主题内置灯箱。</p>
<section class="shortcode-gallery" style="--gallery-columns: 3; --article-content-image-desktop-max-height: none; --article-content-image-tablet-max-height: none; --article-content-image-mobile-max-height: none;"><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample1.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample1_hu_769169bf8aa436a6.webp"
          alt="sample1.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="634"
        >
      </a>
    </figure><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample2.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample2_hu_30929b063163d0c7.webp"
          alt="sample2.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="647"
        >
      </a>
    </figure><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample3.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample3_hu_14c5b80a4fe9479e.webp"
          alt="sample3.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="610"
        >
      </a>
    </figure><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample4.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample4_hu_c2bdf2377283164c.webp"
          alt="sample4.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="892"
        >
      </a>
    </figure><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample5.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample5_hu_bd8ccefce6c594d9.webp"
          alt="sample5.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="1190"
        >
      </a>
    </figure><figure class="shortcode-gallery__item">
      <a class="shortcode-gallery__link" href="/article/shortcodes-demo/sample6.webp" data-lightbox-image>
        <img
          src="/article/shortcodes-demo/sample6_hu_5a08dc0e4d4206dd.webp"
          alt="sample6.webp"
          loading="lazy"
          decoding="async"
          width="1200"
          height="2058"
        >
      </a>
    </figure></section>
<h2 id="why-this-matters">Why this matters</h2>
<p>这些短代码并不是为了把主题变成一个组件库。它们的目的只是给写作者提供一些可复用的小积木，让内容更容易表达，同时又不需要引入额外框架。</p>]]></content:encoded>
    </item>
  </channel>
</rss>
