mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 06:50:47 -07:00
Deploying to gh-pages from @ harttle/liquidjs@371da3da74 🚀
This commit is contained in:
@@ -115,14 +115,16 @@
|
||||
<blockquote class="note warn"><strong class="note-title">常见陷阱</strong><p>LiquidJS 把这个选项默认值设为 <code>true</code> 以兼容于 shopify/liquid,但如果你在使用 <a href="https://github.com/11ty/eleventy" rel="external nofollow noreferrer" target="_blank">eleventy</a> 它会设置默认值 <code>false</code> (参考 <a href="https://www.11ty.dev/docs/languages/liquid/#quoted-include-paths" rel="external nofollow noreferrer" target="_blank">Quoted Include Paths</a>)以兼容于 Jekyll。</p>
|
||||
</blockquote>
|
||||
|
||||
<h2 id="Jekyll-include" class="article-heading"><a href="#Jekyll-include" class="headerlink" title="Jekyll include"></a>Jekyll include<a class="article-anchor" href="#Jekyll-include" aria-hidden="true"></a></h2><p><a href="../api/interfaces/liquid_options_.liquidoptions.html#Optional-jekyllInclude">jekyllInclude</a> 用来启用 Jekyll-like include 语法。默认为 <code>false</code>,当设置为 <code>true</code> 时:</p>
|
||||
<h2 id="Jekyll-include" class="article-heading"><a href="#Jekyll-include" class="headerlink" title="Jekyll include"></a>Jekyll include<a class="article-anchor" href="#Jekyll-include" aria-hidden="true"></a></h2><p class="since">v9.33.0</p>
|
||||
|
||||
<p><a href="../api/interfaces/liquid_options_.liquidoptions.html#Optional-jekyllInclude">jekyllInclude</a> 用来启用 Jekyll-like include 语法。默认为 <code>false</code>,当设置为 <code>true</code> 时:</p>
|
||||
<ul>
|
||||
<li>默认启用静态文件名:<code>dynamicPartials</code> 的默认值变为 <code>false</code>(而非 <code>true</code>)。但你也可以把它设置回 <code>true</code>。</li>
|
||||
<li>参数的键和值之间由 <code>=</code> 分隔(本来是 <code>:</code>)。</li>
|
||||
<li>参数放到了 <code>include</code> 变量下,而非当前作用域。</li>
|
||||
</ul>
|
||||
<p>例如下面的模板中,<code>name.html</code> 没有带引号,<code>header</code> 和 <code>"HEADER"</code> 以 <code>=</code> 分隔,<code>header</code> 参数通过 <code>include.header</code> 来引用。更多详情请参考 <a href="../tags/include.html">include</a>。</p>
|
||||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">// entry template</span><br><span class="line">{% include name.html header="HEADER" content="CONTENT" %}</span><br><span class="line"></span><br><span class="line">// name.html</span><br><span class="line"><header>{{include.header}}</header></span><br><span class="line">{{include.content}}</span><br></pre></td></tr></table></figure>
|
||||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">// entry template</span><br><span class="line">{% include article.html header="HEADER" content="CONTENT" %}</span><br><span class="line"></span><br><span class="line">// article.html</span><br><span class="line"><article></span><br><span class="line"> <header>{{include.header}}</header></span><br><span class="line"> {{include.content}}</span><br><span class="line"></article></span><br></pre></td></tr></table></figure>
|
||||
|
||||
<h2 id="extname" class="article-heading"><a href="#extname" class="headerlink" title="extname"></a>extname<a class="article-anchor" href="#extname" aria-hidden="true"></a></h2><p><strong>extname</strong> 定义了默认的文件后缀,当传入文件名不包含后缀时自动追加。默认值是 <code>''</code> 也就是说默认是禁用的。如果设置为 <code>.liquid</code>:</p>
|
||||
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">{% render "foo" %} 没有后缀,添加 ".liquid" 并加载 foo.liquid</span><br><span class="line">{% render "foo.html" %} 已经有后缀了,直接加载 foo.html</span><br></pre></td></tr></table></figure>
|
||||
@@ -149,7 +151,7 @@
|
||||
|
||||
</div>
|
||||
<footer class="article-footer">
|
||||
<time class="article-footer-updated" datetime="2022-01-19T17:39:45.284Z" itemprop="dateModified">上次更新:2022-01-19</time>
|
||||
<time class="article-footer-updated" datetime="2022-01-19T18:05:53.681Z" itemprop="dateModified">上次更新:2022-01-19</time>
|
||||
<a href="setup.html" class="article-footer-prev" title="安装"><i class="icon-chevron-left"></i><span>上一页</span></a><a href="render-file.html" class="article-footer-next" title="文件渲染"><span>下一页</span><i class="icon-chevron-right"></i></a>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user